Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
ok, I know how to creat a new file,
but how do i write characters to this file?
FILE fp;fp = fopen("filename", "w");
if (fp == NULL) {
/* the open failed */
exit();
}

Sounds like you need to buy a C book or find a tutorial (try www.tutorgig.com). It'll take you forever asking about one statement at a time.
There are numerous functions that will output to a file.
fprintf() works just like printf() except that you add 'fp' as the first parameter:
fprintf(fp, "%s\n", "some string);
I believe putc() is the file version to output a single character. It's probably:putc(fp, 'c');
but I haven't used it in a while. You should be able to look it up as easily as I.

![]() |
JBuilder ?
|
Data validation in VB
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |