fseek64()

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2006
Posts: 647
Reputation: jaepi is an unknown quantity at this point 
Solved Threads: 4
jaepi's Avatar
jaepi jaepi is offline Offline
Practically a Master Poster

fseek64()

 
0
  #1
Oct 9th, 2007
Hello there, do you have any idea where to get a good reference for the function fseek64?
Or does anyone of you here knows this function or is there really a fseek64 function? lol. Thanks!
Retreat!!!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 647
Reputation: jaepi is an unknown quantity at this point 
Solved Threads: 4
jaepi's Avatar
jaepi jaepi is offline Offline
Practically a Master Poster

Re: fseek64()

 
0
  #2
Oct 9th, 2007
In addition, what function which is similar to stat that asks for a FILE* fildes rather than int fildes? Thanks!
Retreat!!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,823
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 748
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: fseek64()

 
0
  #3
Oct 9th, 2007
fseek64 isn't a standard function, so if it exists for your compiler, the documentation will tell you where to find it and how to use it. Have you tried fgetpos and fsetpos? They're designed for large files and the implementation typically uses a 64-bit type as the base for fpos_t.

>what function which is similar to stat that asks for a FILE* fildes rather than int fildes?
There isn't one. If you want that kind of functionality, you need to step outside the standard library.
Last edited by Narue; Oct 9th, 2007 at 9:18 am.
New members chased away this month: 3
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,311
Reputation: vishesh is on a distinguished road 
Solved Threads: 36
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: fseek64()

 
1
  #4
Oct 9th, 2007
I don't know anything about it, infact nothing about 64 bit programming. But a liitle google search helped me to find this.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: fseek64()

 
1
  #5
Oct 9th, 2007
>> what function which is similar to stat that asks for a FILE* fildes rather than int fildes?
the function int fileno(FILE *stream); is part of both posix and single unix specifications. http://www.opengroup.org/onlinepubs/...ns/fileno.html
this would give the file descriptor using which you can call fstat() which also conforms to posix.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 647
Reputation: jaepi is an unknown quantity at this point 
Solved Threads: 4
jaepi's Avatar
jaepi jaepi is offline Offline
Practically a Master Poster

Re: fseek64()

 
0
  #6
Oct 9th, 2007
@Narue - I have heared 'bout fsetpos but I did'nt know that it could deal with larger filetypes. I thought fsetpos64 is used. Thanks! I'll try this instead. Uhmm...have you ever encounter or use fseek64? Which is more preferable between fseek64 and fsetpos?

@vishesh - It says here that fseek64 and even fsetpos64 are new library interfaces? Do have any idea if gcc version 4.0+ supports these functions? Thanks, it really helped me, I'm keeping this document for future references.

@vijayan121 - This is exactly what I need. Thanks!

@all - Thank you very much.
Last edited by jaepi; Oct 9th, 2007 at 10:34 pm.
Retreat!!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,823
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 748
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: fseek64()

 
1
  #7
Oct 10th, 2007
>I have heared 'bout fsetpos but I did'nt know that it could deal with larger filetypes.
That's what fsetpos and fgetpos are there for. fseek is limited to the size of a long integer, but because fsetpos and fgetpos rely on an opaque type (fpos_t) for representing the offset, implementations should be using a type that can handle the file size limit of the system. If your compiler doesn't do that, it's safe to assume that the rest of the standard library may be weak as well.

>Which is more preferable between fseek64 and fsetpos?
Between two functions that do the same thing, but with one being standard and the other not, choose the standard function. But make sure that they really do the same thing. If I were to implement fseek64 on my implementation it would look like this:
  1. typedef off64_t fpos_t;
  2.  
  3. off64_t fseek64 ( FILE *file, off64_t offset, int whence )
  4. {
  5. return _intern_seek ( stream, offset, whence );
  6. }
Which is identical to fseek because it uses fpos_t internally anyway. In other words, fseek64 would be a fluffy function for compatibility with existing code only. But I can't say how it's implemented on another implementation, so you'll have to do some research.
New members chased away this month: 3
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 647
Reputation: jaepi is an unknown quantity at this point 
Solved Threads: 4
jaepi's Avatar
jaepi jaepi is offline Offline
Practically a Master Poster

Re: fseek64()

 
0
  #8
Oct 10th, 2007
I'd rather use fsetpos. Uhmmm, btw, fgetpos and fsetpos come together, right? Or fsetpos may exist without fgetpos (vice-versa).
Retreat!!!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,585
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1487
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: fseek64()

 
0
  #9
Oct 10th, 2007
Since this is a C question and not C++ I'm moving it over to the C board.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,823
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 748
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: fseek64()

 
0
  #10
Oct 11th, 2007
>Uhmmm, btw, fgetpos and fsetpos come together, right?
They're both standard functions. A hosted compiler is required to provide them.
New members chased away this month: 3
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC