Hi all,
I wish to write the contents of a large char array into a file. I open the file for writing and say, fp is the pointer to the file.
and I write :
fprintf(fp,"%s",buff);
Does fprintf write the whole array into the file or is there any inbuilt restriction.Because ,the final expeced file is not containing the whole array, the file writing process stops at a certain stage..actually this is a part of a bigger prog and I am speculating that the problem might lie here.. Can some one explain the internal working of this procedure..
thanks
kris.c
0
Newbie Poster
Recommended Answers
Jump to PostIt will write the contents of buff up the the null. Assuming that it is a char array as opposed to a string, and the char array contains embedded nulls, you will get less output than expected. Perhaps use
fwrite
instead.
All 4 Replies
Dave Sinkula
2,398
long time no c
Team Colleague
brale
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Dave Sinkula
2,398
long time no c
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.