"Adjuto Vasconcelos" <[EMAIL PROTECTED]> wrote:
> I am trying to write a txt file on the Hard disk.
>
> I use this program:
>
> FILE * pFile;
> pFile = fopen ("myfile.txt" , "w");
You should check for a null pointer return.
> fprintf (pFile, "%s This goes in one line \rThis goes on the other
> line");
This is an invalid line. You specify a %s, but you supply no
corresponding argument.
But in answer to your question, \n is the newline character for text
files.
fprintf(pFile, "This goes in one line\nThis another\n");
Note that the last line of a text file should also have a newline
character, otherwise the last line may not be output on some systems.
> fclose (pFile);
--
Peter
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
