|
Three things:
CreateFile() returns INVALID_HANDLE_VALUE on error, not NULL .
1024^4 does not mean "1024 to the forth power."
Why are you trying to allocate that much memory in the first place? It will never succeed.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
-- modified at 22:12 Sunday 27th November, 2005
|
|
|
|
|
Hello,
The problem is that your buffer is too small. Just as Micheal Dunn pointed out: 1024^4 doesn't do what you want. operator ^ is the XOR operator. The result is: 1028.
You should try the following:
char pcBuf[1024] = {0};
DWORD dwBytesRead = 0;
while( !ReadFile(bipFile, pcBuffer, 1024, &dwBytesRead, NULL )
{
if( dwBytesRead < 1024 )
break;
}
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Just FYI, flushing is only meaningful when writing to a file. If you're just reading, there's nothing to flush.
Calling Flush() probably had some other side effect (resetting the file pointer or something) that made your code appear to work.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
"Just because the box has 2 gigabytes of memory doesn't mean you get to use it all!"
-- Rico Mariani, CLR perf guy
|
|
|
|
|
Thanks all! I'll take your advices!
But... I always thought ^ was exponent... And, is 102400 a lot? 102.4 KB... And I do it because one never knows how much bytes a file has... or is there a way to know?
Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
^ is often used in a text environment (like message boards) to mean exponent, however in C it means bitwise XOR.
10244 = 1099511627776, or 1.1 trillion bytes.
You can call GetFileSize() to get the length.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
"Just because the box has 2 gigabytes of memory doesn't mean you get to use it all!"
-- Rico Mariani, CLR perf guy
|
|
|
|
|
|
|
|
the function
CWebBrowser2::Navigate(url)
displays an error message-box if url doesn't exist.
is there any idea to avoid (or do not display) the message-box?
includeh10
|
|
|
|
|
|
what is the use of the CImageIterator
|
|
|
|
|
Having absolutely no clue about what you're actually talking about, since you provide zero context to a complete non-question, I'd give this sound guess:
An abstrcation of iteration through the pixels of an image.
--
The Blog: Bits and Pieces
-- modified at 5:34 Sunday 27th November, 2005
|
|
|
|
|
I am sorry,I can't use English well.My mean is that there is a CImageIterator class in CxImage, and what's use of this class?
|
|
|
|
|
Then my initial guess was correct. I've used CxImage extensively and know for a fact that CImageIterator iterates the pixels of a CxImage .
--
The Blog: Bits and Pieces
|
|
|
|
|
Thank you for your answer.. I have another question that how to display a gif picture by CxImage?
blackeye
|
|
|
|
|
I often get "error LNK2001: unresolved external symbol" for _FunctionName@24,
what is this supposed to mean?
what does this notation _FunctionName@24 mean?
thanks!
|
|
|
|
|
Different compilers/vendors 'decorate' functions names with various schemes when they compile your code into object modules - this is commonly known as 'mangling'
In MSVC for example, its possible to decode the function name AND its parameters from looking at a mangled name. There is also, to make things worse, a difference in 'c' vs c++ name generation ...
That you get a LNK2001 error should be obvious - you have a call to that 'FunctionName' in your code and it cant be found in an object module's symbol/export table - maybe you're not linking against the right object/DLL or such
There are plenty of articles out there detailing how to fix this along with stdcall, cdecl discussions (search to find what I mean), I'm probably not the best person to give you a more in-depth reply than this ..
'g'
|
|
|
|
|
assume there is a link
<a href="file://c:/abc/xxx">
how to know if the file exists?
the link may not be a file, i.e.
xxx=open?param
or something else.
includeh10
-- modified at 23:53 Saturday 26th November, 2005
|
|
|
|
|
|
Can I program TAPI to detect CLI tones instead of DTMF tones?
Thanks for reading.
Vaclav
|
|
|
|
|
with CHttpConnection, we can easily request for a web file by function OpenRequest();
is it possible to request a local file,
such as "file://c:/abc/index.htm"
by CHttpConnection::OpenRequest() or other VC functions ?
includeh10
-- modified at 23:54 Saturday 26th November, 2005
|
|
|
|
|
Using a URL with the file: protocol works when using WinInet directly; I'd imagine that it would work with the MFC wrappers too. Just make sure to get the syntax right - there is a difference between file:// and file:///
For more info, see http://blogs.msdn.com/freeassociations/archive/2005/05/19/420059.aspx[^]
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
what the use of the CxImageIterator Class in CxImage library?
blackeye
|
|
|
|
|
How can a window in a dialog receive keyboard message?
I create a window in a dialog.This window can show 3D drawing including rotation and can receive mouse message,but it can not receive keyboard message.
Please tell me why,Thank you for your answer.My code for create window is as follow.Maybe it need more parameter.
My program for create window is as follow:
R1=CRect(200, 7, 1000, 200);
// TODO: Add extra initialization here
m_pDisplay->Create( NULL, //CWnd default
NULL, //has no name
WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_VISIBLE,
R1,
this, //this is the parent
u1);
sude
|
|
|
|
|
it can receive keyboard input if it gets focus (by SetFocus() function).
the window may need TABSTOP style or something else.
includeh10
|
|
|
|