fucking fread( );
Hi all;
I''m having a very strange problem here...
Here is some part of the code:
...
profiles = new cPROFILE[number_of_profiles];
fread(profiles,1,sizeof(cPROFILE)*number_of_profiles,file);
delete []profiles;
...
Of course the line "delete []profiles;" is not there, but if I put it there it generates an Acess Violation Error...but when i take off the fread line, the error disappears. May it be a compiler error?
Thanx all
i am almost pretty sure that your problem is in the call to fread try
fread (profiles,sizeof(cPROFILE),number_of_profiles,file);
hope that helps
fread (profiles,sizeof(cPROFILE),number_of_profiles,file);
hope that helps
I''ve already tried using
fread(profiles,sizeof(cPROFILE),number_of_profiles,file);
but it didn''t solve my problem...
fread(profiles,sizeof(cPROFILE),number_of_profiles,file);
but it didn''t solve my problem...
the only thing the two separate parameters do is if it reaches the end of file early, it reads the last whole structure before the end, but internally it just multiplies and reads. 1, x works fine, i use that all the time.
There is no pointers inside cPROFILE....and even using &profiles[0] (i used it before), it doesn''t work....when i inspect profiles (with quickwatch), it is allocated and with the correct values...so the fread() is working, as well as new()...i think i''ll try to copy this part in other application and see the results...
heh, well:
(profiles == &profiles[0]) == true
edit: forgot one 's'
[edited by - angry on July 5, 2003 2:16:25 AM]
(profiles == &profiles[0]) == true
edit: forgot one 's'
[edited by - angry on July 5, 2003 2:16:25 AM]
Is that the exact code? Is there anything that goes on between the call to
fread
and the call to delete
?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement