Re: Create files larger than 2GB with open or CreateFile?



Isn't there something about the type of the filing system? It needs to be
NTFS. At least, something like that rings a bell.

Bill

"Ben Voigt [C++ MVP]" <bvoigt@xxxxxxxxxxxxxxxx> wrote in message
news:FEFB55A2-3D3D-4871-B46D-0643731C88E9@xxxxxxxxxxxxxxxx


"Nick Shallery" <nicknide@xxxxxxxxxxx> wrote in message
news:A3F5EF45-7356-42B7-AE3F-D68E0F5E1FDC@xxxxxxxxxxxxxxxx
SetFilePosition? you mean is SetFilePointer?
Yes, The new API SetFilePointerEx can be used.

Yeah that's what I meant. Anyhow the MSDN docs for those functions are
messed up b/c I don't think SetFilePointer was introduced in Win2k, but
that's what the page says.

OT: The suspicion is that someone doesn't understand the difference
between having an OS supporting a library function (that is having an
implementation) and Microsoft offering support for an OS in the sense of
security patches, and thus is removing the old OSes from the programmer
documentation as their security support expires.



"Ben Voigt [C++ MVP]" <bvoigt@xxxxxxxxxxxxxxxx> дÈëÏûÏ¢
news:OYICxaW2JHA.4272@xxxxxxxxxxxxxxxxxxxxxxx
Tim Roberts wrote:
"Tim Jones" <timj@xxxxxxxxxxxxxx> wrote:

"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote:
"Tim Jones" <timj@xxxxxxxxxxxxxx> wrote:

I'm moving a slew of code from Solaris to Windows and one issue
that I've run into is the creation of files larger than 2GB. I've
searched MSDN, but everything is either about DB access or RAM.

Under Solaris, I use a flag O_LARGEFILE in the modes flag.
However, I don't find a similar documentation for any Windows file
creation API menber. Is this possible (understanding that we are
only working with NTFS filesystems)?

Nothing special needed with the native APIs (CreateFile, ReadFile,
WriteFile).

That's what I thought, but I'm getting write failures as soon as I
hit the 2GB point.

That won't happen with standard WriteFile calls on an NTFS file
system. It can happen with a memory-mapped files. However, remember
that most removable devices (USB drives, USB flash drives) use FAT
file systems, where there are such limits.

Also even the Win32 APIs require special care, for example the
OVERLAPPED structure requires you to fill out two fields instead of one,
to identify the offset in a file > 2GB, SetFilePosition requires special
attention, etc.


Are you using stdio calls (fopen, fwrite)?



__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4103 (20090525) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4103 (20090525) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






.