[plug] C, bad syntax etc.
John Knight
anarchist_tomato at hotmail.com
Tue Nov 19 09:53:30 WST 2002
Cheers mate, don't worry, it's out of the loop. ;) Now I'm trying to figure
out how to search through text for numbers only! *groan* heh. ;)
Make lunch, not war.
>
>Hello, John.
>
>The following code works as the simplest case. @@@@
>
>#include <stdio.h>
>FILE *fptr;
>main()
>{
>fptr = fopen ("myfile.txt", "a+");
>fprintf (fptr, "hello\n");
>fclose (fptr);
>}
>
>As Carl noted earlier, it would pay to take the fopen / fclose pair out of
>your loop construct. That will avoid having to use "a" or "a+" in the
>open statement; a simple "w" would then suffice, over writing any existing
>output file or creating one if previously nonexistent.
>
>As to why your fclose doesn't behave... anyone??? Corrupted library
>maybe?
>
>HTH,
>Denis
>
>@@@@ based on the recent perl sort "competition" for skinny code, I am
>uneasy in stating absolutes anymore :-) If anyone has a simpler version
>of the above, I'm all eyes.
>
>Cheers.
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
More information about the plug
mailing list