-
October 19th, 2015, 03:33 AM
#1
fread() bug in Visual C runtime library, what is the Visual C++ version?
I read following forum post about the problem that fread() function can't read large files:
http://stackoverflow.com/questions/7...-read-by-fread
I am now writing a program that need large file support on VS2008, I use fopen, fread and fwrite to process files, some of the files maybe about 4G. If there is a bug in fread() function in Visual C runtime library, what is the version of the Visual C++? Thank you!
-
October 19th, 2015, 05:34 AM
#2
Re: fread() bug in Visual C runtime library, what is the Visual C++ version?
Since you are asking in the Visual C++ Programming forum, I can suggest you using either Win32 API (CreateFile, ReadFile, WriteFile,...) or MFC CFile class methods.
Victor Nijegorodov
-
October 19th, 2015, 07:14 AM
#3
Re: fread() bug in Visual C runtime library, what is the Visual C++ version?
You can use CFile which is based on basic windows file access.
don't use CStdioFile, which is based around FILE and fread() (and it's family of functions).
-
October 22nd, 2015, 04:57 AM
#4
Re: fread() bug in Visual C runtime library, what is the Visual C++ version?
Thank you very much for your replies! I am re-writing the code using CreateFile, ReadFile, WriteFile, and CloseHandle. and commented out the fopen, fread and fwrite.
But I still want to know is there really a bug in fread in Visual C++ that can't process large file. Thanks!
Following are similar questions I searched online :
https://social.msdn.microsoft.com/Fo...rum=vclanguage
http://bytes.com/topic/c/answers/825...ails-files-4gb
Last edited by forester; October 22nd, 2015 at 05:13 AM.
-
October 22nd, 2015, 06:44 AM
#5
Re: fread() bug in Visual C runtime library, what is the Visual C++ version?
it's not a bug, it's simply how things are. fread returns a size_t and takes size_t parameters, which on win32 has the range of an unsigned int.
can't fix this without making the code non-standard C.
if you compile as Win64, it'll work.
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
|