Why isn't this working?
fwrite( notes->notes, sizeof( NOTE ), notes->nChildren, dbFile );
notes->notes is an array of NOTE, the array size being notes->nChildren ...
This is a discussion on fwrite within the Windows Programming forums, part of the Platform Specific Boards category; Why isn't this working? fwrite( notes->notes, sizeof( NOTE ), notes->nChildren, dbFile ); notes->notes is an array of NOTE, the array ...
Why isn't this working?
fwrite( notes->notes, sizeof( NOTE ), notes->nChildren, dbFile );
notes->notes is an array of NOTE, the array size being notes->nChildren ...
Don't know. Things to check include return value from fwrite, whether notes->notes is pointing to what you think it should be pointing to, notes->nChildren is a valid value (and that there are that number of NOTES pointed to by notes->notes) and that dbFile is a valid *FILE. Try replacing some of the values with literals and see if that works as expected.
If you need more help you're going to have to post more code, preferrably a small example that reproduces the problem.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Why don't you check the return result from fwrite(), and also the return result from ferror() following a call to fwrite()
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
Alrighty, I've found my problem I think ...
nChildren = 0, but it is still written as expected...But notes isn't written because it is 0 ..
Should be able to fix it, thanks ...