Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

file > 2Gb

mhellmann
Beginner
355 Views
Hi all !
under linux
I try to write files but the limitation is 2Gb !!!
I saw that ipc compiler accept gnu option and try the options
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
it doesn't seem to run ... it doesn't run !
I think I've forgot something somewhere !
help needed !!!! please
0 Kudos
3 Replies
DAVID_M_Intel2
Employee
355 Views
I don't see whether any details as to whether you are using C or C++. If C I would expect the same defines to work in icc as in gcc. In C++ there is a potential problem with libstdc++. I have not looked at this for some time (18 months?) so perhaps there have been changes there to support big files.
An example of what you are doing would help.
0 Kudos
mhellmann
Beginner
355 Views
It' C++ !!!
example :
int main()
{
boolthe_loop = true;
ofstream _pFile("the_file");
while (the_loop)
_pFile<<"xxxxxxxxxxxxxxxx";
_pFile.close();
return 1;
}
stupid example, but used to see the limit of a file size under linux....
when the run falls down, the size of file is 2Gb !
I compil and link this using icpc, with option flag
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
....
no more ideas .........
or maybe other options exist...
HELP !
0 Kudos
jim_dempsey
Beginner
355 Views

If Linux shares some of the same problems as Windoz then for compatibility reasons ofstream will be restricted to use a data structure that is limited to DWORD (or integer). You will have to look into your Linux programmer's guide for something like "Extended file open" whereby the file data structure uses _int64 type of integer. MS tends to append "Ex" as a suffix to the file functions/data structures.

Jim Dempsey

0 Kudos
Reply