Re: [Dev-C++] Quick flat-file searching and I/O
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <ci...@ya...> - 2003-08-03 02:05:41
|
Small problem. Room descriptions are strings of variable length. Also the exit descriptions are included in the same structure(also varible length strings). This can cause the size of a room to vary greatly). This might still work if I were to put a limit on how long a room description could be and padd shorter descriptions to make it equal the standard size ----- Original Message ----- From: "Kevin Wood" <ke...@me...> To: "Dev-C Mailing List" <dev...@li...> Sent: Friday, August 01, 2003 7:58 PM Subject: Re: [Dev-C++] Quick flat-file searching and I/O > Hi everyone, > > I think the quickest way to access a portion of a file is to structure it, > then use the fseek function from stdio. > > In the case we are considering, the data for each room should be about the > same size. For example, if the data for a room is 500 bytes, each room's > data can be stored in a file at 500 byte intervals, then accessed using the > standard library routines. So to access room 50, you would set the file > pointer at 50 x 500. > fseek(room_file_pointer, room_number * 500, SEEK_SET); > > If the data for each object is large, several files may be needed, maybe > with an index file. > > Kev. > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |