Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass a value greater than maximum value of long type to fseek in C

Tags:

c++

c

objective-c

I need to pass some values to the fseek() method in C which are greater than the maximum value of the signed long type (2147483647). But if I do like below the value of the result is -1 which is not success. Is there anyway that I can do this?

//fp is the pointer to fopen method
unsigned long long index=2147483648;
int status = fseek(fp, index, SEEK_SET);
like image 399
user1120633 Avatar asked Jan 03 '12 06:01

user1120633


People also ask

Why we use long long int in C?

long long int data type in C++ is used to store 64-bit integers. It is one of the largest data types to store integer values, unlike unsigned long long int both positive and negative. Some properties of the long long int data type are: Being a signed data type, it can store positive values as well as negative values.

How do I return long long int in C++?

C++ llabs() The llabs() function in C++ returns the absolute value of a long long int data.


1 Answers

Since you tagged this with "Objective-C", I'm assuming you are also thinking about Macintosh.

Check out fseeko (which takes a 64bit number).

like image 120
Michael Dautermann Avatar answered Sep 23 '22 14:09

Michael Dautermann