From: Thorsten B. <tho...@do...> - 2011-05-30 11:53:50
|
Hi Arjen! >> BTW: You can also define a constant for the string length instead of >> using integer literals in the code. > > Good thinking! Actually, as I look at the code, I see that it presumes > that lines are never longer than 30 characters. If I understand http://en.wikipedia.org/wiki/Fgets corrytly, then the code assumes lines to be no longer than 29 characters because fgets always appends a NUL-byte to the string read (or do I misunderstand something here?). This is why I also thought that you could omit changing the lineending to a NUL-byte. Howevere, just changing all /r, /n to NUL is the safest way, I guess. > If they are, the reading process will fail in an uneasy way. I will try > and take care of that too. Why does it fail in an uneasy way? Will strlen not terminate, because there is no NUL-byte in the string returned by fgets then? -- Gruß, Thorsten |