Hello all,
When trying to close a file using fclose(), I get the following error:
“No message of desired type”.
I don’t understand what has gone wrong and what I can do to fix this.
Thanks in advance for any support you can give
Regards,
Rodney Gullickson
Project Engineer
Tritronics (Australia) Pty. Ltd.
Tel : +61 7 3240 1922
Fax : +61 7 3891 9336
Email : rodneyg@tritro.com.au
Browski <bstar81@hotmail.com> wrote:
Hello all,
When trying to close a file using fclose(), I get the following error:
“No message of desired type”.
I don’t understand what has gone wrong and what I can do to fix this.
Thanks in advance for any support you can give
Can you post a test case that reproduces this problem?
-Adam
amallory@qnx.com
Browski <bstar81@hotmail.com> wrote:
Hello all,
When trying to close a file using fclose(), I get the following error:
“No message of desired type”.
First question: have you checked the return value from fclose()? If
fclose() has NOT failed (if it succeeded), then the value in errno
is meaningless.
Or, to put it another way, you shouldn’t check errno until after
you have verified that the function returned a failure – in the
case of fclose() this would mean non-zero.
Good:
if (fclose( fp ) )
{
perror(“fclose:”);
}
Bad:
fclose(fp);
if (errno != 0)
perror(“fclose:”);
-David
QNX Training Services
dagibbs@qnx.com
One more very disappointing thing in QNX4 is that ‘errno’ is not thread
safe. If your app is multi-threaded, then errno can not be trusted if more
than one thread encounters an error.
Bill Caroselli
“David Gibbs” <dagibbs@qnx.com> wrote in message
news:9mlmmr$86a$1@nntp.qnx.com…
Browski <> bstar81@hotmail.com> > wrote:
Hello all,
When trying to close a file using fclose(), I get the following error:
“No message of desired type”.
First question: have you checked the return value from fclose()? If
fclose() has NOT failed (if it succeeded), then the value in errno
is meaningless.
Or, to put it another way, you shouldn’t check errno until after
you have verified that the function returned a failure – in the
case of fclose() this would mean non-zero.
Good:
if (fclose( fp ) )
{
perror(“fclose:”);
}
Bad:
fclose(fp);
if (errno != 0)
perror(“fclose:”);
-David
QNX Training Services
dagibbs@qnx.com