|
What is the value of lSize?
|
|
|
|
|
Its correct.Equal to file size.
Mazy
No sig. available now.
|
|
|
|
|
I tried your code and lSize and i have the same value.
|
|
|
|
|
Yes,Same here.
Mazy
No sig. available now.
|
|
|
|
|
Ok, so what's the problem? You instructed it to read lSize bytes and it read i bytes, both of which were the same.
|
|
|
|
|
Thw point is that svRead does not contain all datas.
Mazy
No sig. available now.
|
|
|
|
|
Mazdak wrote:
it only read 3 or 4 first character
How do you verify this? Does a byte with value of zero at the fourth or fifth position confuse your viewer?
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Yes,I guess this is the problem.
Mazy
No sig. available now.
|
|
|
|
|
Don't use fopen() or the other C runtime file functions from <stdio.h> for reading binary data. They're only designed for use with text files.
Under Windows, use CreateFile() to open a file and ReadFile() to read data from it. You can also use the _open() function and _read() to read from the file, which may be more portable (the POSIX binary functions are named open() and read()).
--
Mike Dimmick
|
|
|
|
|
Mike Dimmick wrote:
Don't use fopen() or the other C runtime file functions from <stdio.h> for reading binary data. They're only designed for use with text files.
Where did you get this from? fopen(), fread(), fwrite(), and fclose() operate on both text files and binary files. They always have.
|
|
|
|
|
DavidCrow wrote:
fopen(), fread(), fwrite(), and fclose() operate on both text files and binary files. They always have.
Don't you have to add a flag or something in order to read binary data?
Perhaps not with the fXXX() family... I don't have MSDN near my hands so I can't check if it is so.
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Rickard Andersson18 wrote:
Don't you have to add a flag or something in order to read binary data?
fopen(szpath,"rb");
b means binary.
Anyway,I find out that was problem with debugger.It contains correct value but debugger can't show it.
Mazy
No sig. available now.
|
|
|
|
|
Mazdak wrote:
It contains correct value but debugger can't show it
Have you tried using any of the m-type symbols in the watch window?
I use these two quite often:
m
ma
I've never used these:
mb
mw
md
mq
mu
|
|
|
|
|
Rickard Andersson18 wrote:
I don't have MSDN near my hands so I can't check if it is so.
If you have access to CodeProject, you have access to MSDN[^]
|
|
|
|
|
DavidCrow wrote:
If you have access to CodeProject, you have access to MSDN
True, but I don't waste any time and money of big loadings at MSDN online with my damn modem!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Why you don't use the Win32 API functions CreateFile , ReadFile , ... ?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I use this coed to read files:
FILE *file = fopen(szpath,"rb");
if(file!=NULL)
{
char *svRead;
fseek (file , 0 , SEEK_END);
long lSize = ftell (file);
rewind (file);
svRead = (char*) malloc (lSize);
int i = fread(svRead,sizeof(char),lSize,file);
}
But it works only for TEXT files ad when I read jpg files with it ,it only read 3 or 4 first character.
Mazy
No sig. available now.
|
|
|
|
|
Hi
I use CRecordset to access to MSAccess Database
When I want to access database With ODBC & without CDatabase it work well.
But I want To use db without using ODBC & directly, I used CDatabase To do it but Recordset will readonly
CDatabase Database;
Database.OpenEx("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=DB\\TT.mdb",0);
CMyRecordset rs(&Database);
please Help me
Iman
|
|
|
|
|
searching for a good report-printing c++ library
|
|
|
|
|
How to change the color of a scroll bar's appearance?
Please help me!
stanley
|
|
|
|
|
|
Thanks for your help.;P
stanley
|
|
|
|
|
How can we create a little float window on top of desktop to receive drop from other application?
I can't find any meterial descript it. Maybe i take a wrong express :<
|
|
|
|
|
Take a look at this!
http://www.codeproject.com/tools/ontop.asp[^]
jhaga
CodeProject House, Paul Watson wrote:
...and the roar of John Simmons own personal Nascar parked in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving *c.* and Deb scoffing chocolates in the corner.
..Good heavens!
|
|
|
|
|
A simple question. how to add a new menuitem to IE's right button popup menu?
|
|
|
|