Re: [Dev-C++] I´d like to know your hints about file manipulations
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Per W. <pw...@ia...> - 2008-06-23 15:02:43
|
I normally let fgets read full lines, and then perform any decoding of the contents. Then you have a number of options. Comma-separated. Semicolon-separated. Tab-separated. Encoded inside quotation marks. I normally use strchr() to process the lines I have read with fgets(). /pwm On Sat, 21 Jun 2008, André Macário Barros wrote: > Dear users, > > I like this list because we can ask questions > regarding not only about Dev-cpp, like the one > that I present to you now. > > Consider the following restrictions: > -only ANSI-C commands; > -not C++; > -for file manipulation, only the following > commands: fopen(), fscanf(), fgets(), > feof(), and fclose(); > > Inside this scenario, people can easly work > read and write files containing integers and floating > point numbers. Situations like names, sex (male/female), > option (yes/no), etc, can be replaced by integer codes. > > My question is: > What is your style to work with strings, i.e., names > for example: for a program that expects to read a name from > a file (with spaces, variable size, etc), do you previosly > indicate a fixed number of characters (40, for example) and > use fgets twice (to read the 40 characters and read the '\n')? > > Thanks a lot in advance > André > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > 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 > |