How to find the fprintf() actual error?

Include #include ... rc = fprintf(...) if (rc.

1 You should not declare errno yourself, just include ; it might be a macro, not a variable. – Mike Seymour Apr 20 at 7:52 point taken. Libc os dependent.

I think on older linux libcs you'd have to declare it extern tho. Corrected. – sysfault Apr 20 at 8:01 Err, adirau, that's even worse.

#ifndef will only work for preprocessor macros, not variables. You're better off ditching that whole #ifdef block since ISO mandates that errno. H defines an errno "variable".

I fixed it up for you, hope you don't mind. – paxdiablo Apr 20 at 8:19 but errno is a preprocessor macro, at least on unix and linux :) – sysfault Apr 20 at 10:46 I used the ifdefs thinking of the old errno libc linux implemenation where errno is(/was? ) exactly an int; so if errno isn't a cpp macro then it should be declared extern but those are oldtimes you are right – sysfault Apr 20 at 10:53.

You need to check the value of errno. Most library functions will set it to the specific error code and you can either look it up in errno. H or use perror or strerror to get a user-readable version.

For example: #include #include #include int main (void) { FILE *fh = fopen ("junk", "w"); if (fh! = NULL) { if (fprintf (fh, "%s", "hello").

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send