in c fseek,fopen this all function works for long int means only handle file of 2 gb.
now how can i open file whose size is more than 2 GB?
in c fseek,fopen this all function works for long int means only handle file
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As the commenters have already explained, whether you can open a file of more than 2GB depends on the OS and C library, not on the compiler on
sizeof(long). If your OS supports such files, you should be able tofopenthem, although you may have to set a flag (#define _FILE_OFFSET_BITS 64for Linux).Then,
fseekindeed cannot seek to positions farther away thanLONG_MAXin a single call. You can either callfseekseveral times in a loop, which can be cumbersome, or check if your platform hasfseekowhich takes an offset argument of typeoff_t. That type should be big enough to capture the size of any (regular) file on your system if you set the right options.fseekois available on newer Linux and all POSIX-2001-compliant OSs.