Click here to Skip to main content
15,906,708 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: post/send messages Pin
thathvamsi29-Jun-06 20:30
thathvamsi29-Jun-06 20:30 
GeneralRe: post/send messages Pin
Weiye Chen29-Jun-06 20:38
Weiye Chen29-Jun-06 20:38 
QuestionPrinting Pin
RockyJames29-Jun-06 14:32
RockyJames29-Jun-06 14:32 
AnswerRe: Printing Pin
Hamid_RT29-Jun-06 20:26
Hamid_RT29-Jun-06 20:26 
QuestionOnDestroy function Pin
Ram Murali29-Jun-06 14:31
Ram Murali29-Jun-06 14:31 
AnswerRe: OnDestroy function Pin
PJ Arends29-Jun-06 17:38
professionalPJ Arends29-Jun-06 17:38 
QuestionHow to add common dialog to my dialog [modified] Pin
huynhnb29-Jun-06 13:36
huynhnb29-Jun-06 13:36 
AnswerRe: How to add common dialog to my dialog Pin
_AnsHUMAN_ 29-Jun-06 19:53
_AnsHUMAN_ 29-Jun-06 19:53 
AnswerRe: How to add common dialog to my dialog Pin
Hamid_RT29-Jun-06 20:13
Hamid_RT29-Jun-06 20:13 
QuestionSaving to file in human readable form Pin
elixxo2929-Jun-06 13:34
elixxo2929-Jun-06 13:34 
AnswerRe: Saving to file in human readable form Pin
Michael Dunn29-Jun-06 15:44
sitebuilderMichael Dunn29-Jun-06 15:44 
QuestionNetWkstaGetInfo() Question Pin
RobJones29-Jun-06 13:23
RobJones29-Jun-06 13:23 
QuestionRe: NetWkstaGetInfo() Question Pin
David Crow30-Jun-06 2:26
David Crow30-Jun-06 2:26 
AnswerRe: NetWkstaGetInfo() Question Pin
RobJones30-Jun-06 3:29
RobJones30-Jun-06 3:29 
QuestionRe: NetWkstaGetInfo() Question Pin
David Crow30-Jun-06 3:45
David Crow30-Jun-06 3:45 
QuestionCListCtrl Notify msg Pin
ftsOne29-Jun-06 11:53
ftsOne29-Jun-06 11:53 
AnswerRe: CListCtrl Notify msg Pin
Michael Dunn29-Jun-06 15:47
sitebuilderMichael Dunn29-Jun-06 15:47 
Questionfile manipulation with fopen(), fscanf() Pin
kitty529-Jun-06 10:06
kitty529-Jun-06 10:06 
AnswerRe: file manipulation with fopen(), fscanf() Pin
David Crow29-Jun-06 10:16
David Crow29-Jun-06 10:16 
GeneralRe: file manipulation with fopen(), fscanf() Pin
kitty529-Jun-06 10:25
kitty529-Jun-06 10:25 
QuestionRe: file manipulation with fopen(), fscanf() Pin
David Crow29-Jun-06 11:32
David Crow29-Jun-06 11:32 
AnswerRe: file manipulation with fopen(), fscanf() Pin
kitty529-Jun-06 11:37
kitty529-Jun-06 11:37 
GeneralRe: file manipulation with fopen(), fscanf() Pin
David Crow30-Jun-06 2:14
David Crow30-Jun-06 2:14 
AnswerRe: file manipulation with fopen(), fscanf() [modified] Pin
Zac Howland29-Jun-06 10:32
Zac Howland29-Jun-06 10:32 
GeneralRe: file manipulation with fopen(), fscanf() Pin
kitty529-Jun-06 10:55
kitty529-Jun-06 10:55 
Zac Howland wrote:
if (fileSize != fread(buffer, sizeof(char), fileSize, fpread))
{
printf("Failed to read file.\n");
fclose(fpread);
delete [] buffer;
buffer = NULL;
return -1;
}


Does the file need to be written in a special format?
I created it using notepad and saved it as: data.txt

When I try your code I get: Failed to read file.
This means that the number of items actually read (this is wha fread() returns) is not = to the fileSize.
This is true. So I don't understand why we're comparing the fileSize fo the number of items being read....


Kitty5

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.