W
Walter Dnes (delete the 'z' to get my real address
I'm doing some stuff at home that I can't justify doing on work time,
mostly to learn C programming. But it might possibly be useful at work.
I run linux at home at home and Windows at work. One portability
question arises.
Given fgets() on a file...
linux file with a line with 22 columns of data plus CHR(10), strlen()
of the resulting string = 23
DOS file with a line with 22 columns of data plus CHR(13) + CHR(10),
strlen() of the resulting string = 23 ??? (I'm not certain.) Is this
platform-specific or does ANSI C address this situation ?
If absolutely necessary, I suppose my program could...
- open a scratch file
- fprintf(scratch_file, "Hello world.\n")
- close the scratch file
- re-open the scratch file
- gets and take strlen() of the result.
- close the scratch file
And finally use the count of bytes in the string to adjust some
variables (bleagh).
mostly to learn C programming. But it might possibly be useful at work.
I run linux at home at home and Windows at work. One portability
question arises.
Given fgets() on a file...
linux file with a line with 22 columns of data plus CHR(10), strlen()
of the resulting string = 23
DOS file with a line with 22 columns of data plus CHR(13) + CHR(10),
strlen() of the resulting string = 23 ??? (I'm not certain.) Is this
platform-specific or does ANSI C address this situation ?
If absolutely necessary, I suppose my program could...
- open a scratch file
- fprintf(scratch_file, "Hello world.\n")
- close the scratch file
- re-open the scratch file
- gets and take strlen() of the result.
- close the scratch file
And finally use the count of bytes in the string to adjust some
variables (bleagh).