How to Open a File In Binary Mode using fopen

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi
i want to know how can i open a file using fopen in vc++ win32 console
application in binary mode.
It is mandatory to use fopen only.
Actually what i have to do is to read from an existing file and copy it in
another file.
The existing File is "file1.doc" means the file is of doc type.
the code listed below is reading from the existing file , it is making a new
file of desired length , it is showing unexpectable characters in that new
generated file and this is the problem HOW
CAN WE OBTAIN original characters that are in the existing DOC file in that
newly created file.
The same code is working for a TXT file but it is not working for a DOC
file.

Please help me. I WILL BE VERY THANKFUL TO YOU.

FILE * pFile , * sFile ;
char filepath[60],filepath1[80];
cin>>filepath; //filepath of existing doc file
pFile = fopen ( filepath, "r");

cin>>filepath1; //filepath of doc file to be created
sFile = fopen ( filepath1 , "w" );
numr= fread (list,sizeof(char),629146,pFile);
numw= fwrite(list,sizeof(char),629146,sFile);






.



Relevant Pages

  • Re: How to Open a File In Binary Mode using fopen
    ... i want to know how can i open a file using fopen in vc++ win32 console ... application in binary mode. ... It is mandatory to use fopen only. ... it is showing unexpectable characters in that new ...
    (microsoft.public.vc.language)
  • Re: How to Open a File In Binary Mode using fopen
    ... i want to know how can i open a file using fopen in vc++ win32 console ... application in binary mode. ... It is mandatory to use fopen only. ... it is showing unexpectable characters in that new ...
    (microsoft.public.vc.language)