Problem with fprintf ?
-
Anyone know of a problem with the old fprintf function? I have been using it for years now and all of a sudden during some testing it has started to crash inside the call.
iltallman wrote: I have been using it for years now and all of a sudden during some testing it has started to crash inside the call. Could you be trying to reference a memory location that no longer exists? -Nick Parker
-
iltallman wrote: I have been using it for years now and all of a sudden during some testing it has started to crash inside the call. Could you be trying to reference a memory location that no longer exists? -Nick Parker
-
Anyone know of a problem with the old fprintf function? I have been using it for years now and all of a sudden during some testing it has started to crash inside the call.
I had a case once, where I did something like this.
char *str = GetSomeInputString(); fprintf( F, str );
worked pretty well, but would crash once in awhile when someone put a %s. changed it to:fprintf( F, "%s", str );
all is well.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)
-
I had a case once, where I did something like this.
char *str = GetSomeInputString(); fprintf( F, str );
worked pretty well, but would crash once in awhile when someone put a %s. changed it to:fprintf( F, "%s", str );
all is well.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)
fprintf has always worked well for me. Except when I did something boneheaded like you point out. Sometimes I have done things like
int i = 8675309; char *str = GetSomeString() fprintf(F, "%s", i, str);
-
fprintf has always worked well for me. Except when I did something boneheaded like you point out. Sometimes I have done things like
int i = 8675309; char *str = GetSomeString() fprintf(F, "%s", i, str);
Robert Little wrote: int i = 8675309; Reminds me of a song!!
-
fprintf has always worked well for me. Except when I did something boneheaded like you point out. Sometimes I have done things like
int i = 8675309; char *str = GetSomeString() fprintf(F, "%s", i, str);
I've done that too. None of us are exempted from bonehead mistakes..... I've certainly had my share, and unfortunately they seem to be the most difficult to track down... It's my guess that the writer of this question made some boneheaded mistake.... Have fun! P.S. I don't really consider fprintf to be old....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)
-
No. I looked in the debugger at all the data and attributes - it all looked good with appropriate NULL ending strings
well -- fprintf works fine for me when I don't do something boneheaded.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Santa Cruz Networks / VidiTel / Reality Fusion (pick a name -- may change at any moment)
-
Anyone know of a problem with the old fprintf function? I have been using it for years now and all of a sudden during some testing it has started to crash inside the call.
A common problem with formatting is that the parameters don't match the formatting string, and VC++ doesn't do a check to see if they match. Elaine :rose: The tigress is here :-D