|
-
June 5th, 1999, 10:28 AM
#1
(CFile) Reading binary file stops at 0x1A, why ?
Hi,
I want to read a binary file with CFile.
Something like this:
CFile file("hhh", FLAGS);
file.Read(buffer, 4096) ..
But the readings stops when it encounters a 0x1A. How is it possible to read any binaray file,
in my case a JPG-file ??
Thanks in advance
Dan
Dan
--------------------------------------
It's always nice to see, whether the hints work. I appreciate feedback
-
June 5th, 1999, 10:43 AM
#2
Re: (CFile) Reading binary file stops at 0x1A, why ?
Hi!
How can You read file without openning it?
Check your flags when You open file
-
June 5th, 1999, 10:59 AM
#3
Re: (CFile) Reading binary file stops at 0x1A, why ?
it was just a sample, the minimum you have to know
I want to read from the internet OR from a file from hard-disk.
the complete code here
int iNumberOfBytesRead;
char buffer[4096];
CInternetSession internetSession("PicScan");
CInternetFile * internetFile = (CInternetFile *)internetSession.OpenURL("E:\\Developper\\Image\\flower.jpg");
CString strFileName = "test";
CFile fileSave(strFileName, CFile::modeCreate | CFile::modeReadWrite);
while (1)
{
iNumberOfBytesRead = internetFile->Read(buffer, 4096);
fileSave.Write(buffer, iNumberOfBytesRead);
if (iNumberOfBytesRead == 0)
break;
}
internetFile->Close();
Dan
--------------------------------------
It's always nice to see, whether the hints work. I appreciate feedback
-
June 5th, 1999, 11:23 AM
#4
Re: (CFile) Reading binary file stops at 0x1A, why ?
Well. In this case see definition of internetSession.OpenURL(). By default you have ASCII_TEXT mode WORD dwFlags = INTERNET_FLAG_TRANSFER_ASCII.
You must change it.
-
June 6th, 1999, 04:37 AM
#5
Re: (CFile) Reading binary file stops at 0x1A, why ?
Hi,
Thanks a lot for your help. I guess my first question was a bit too slim.
Anyway, it works great.
Regards
Dan
Dan
--------------------------------------
It's always nice to see, whether the hints work. I appreciate feedback
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|