English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Is it possible to define
FILE*output;
etc.....
and write data to a file using
fprintf( ) function?

2007-03-17 21:22:34 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

not sure if you can use fprintf(), but you can use fwrite().

it takes the FILE pointer, a character array, the length and another parameter (cant remember what it is, but set it to 1).

i think its like this:

FILE *fPtr;
char text[] = "testing";

fPtr = fopen("filename.txt, "w");
fwrite(text, getlen(text), 1, fPtr); //i think this is the order

2007-03-18 02:13:52 · answer #1 · answered by justme 7 · 1 0

fedest.com, questions and answers