|
-
August 20th, 2002, 09:39 AM
#1
fprintf...
hi i have a function called
Code:
writetofile(const char* filename)
{
FILE *stream;
stream = fopen(filename,"a+");
fprintf( stream,"%s",strptr); // printing the orginal string
fprintf(stream," ");
fclose(stream);
}
when I call the function first time, i got no proglem.. but when i calll next time, I got run time error.... why is that?
BP
-
August 20th, 2002, 11:44 AM
#2
BeePo,
Where is the error occurring? Can you pin-point the line
of code in your debugger? I would pay special attention
to the fopen return file pointer and the "strptr" pointer.
Make sure niether are null and the "strptr" is properly
null terminated and not already deallocated. You could
also save yourself a line of code by combining the two
fprintf statements into one. Just put the space of the
string conversion specifier.
Regards, willchop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|