How to Open a File In Binary Mode using fopen
- From: "Alok Singh" <alok.singh@xxxxxxxxxxxxxxx>
- Date: Tue, 7 Mar 2006 18:51:08 +0530
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);
.
- Follow-Ups:
- Re: How to Open a File In Binary Mode using fopen
- From: Frederico Pissarra
- Re: How to Open a File In Binary Mode using fopen
- From: Andy Sinclair
- Re: How to Open a File In Binary Mode using fopen
- From: James Brown [MVP]
- Re: How to Open a File In Binary Mode using fopen
- Prev by Date: Re: How to Open a File In Binary Mode using fopen
- Next by Date: Re: Days in month function
- Previous by thread: Days in month function
- Next by thread: Re: How to Open a File In Binary Mode using fopen
- Index(es):
Relevant Pages
|