| | |
fseek64()
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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.
>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
I don't know anything about it, infact nothing about 64 bit programming. But a liitle google search helped me to find this.
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
>> what function which is similar to stat that asks for a FILE* fildes rather than int fildes?
the function
this would give the file descriptor using which you can call fstat() which also conforms to posix.
the function
int fileno(FILE *stream); is part of both posix and single unix specifications. http://www.opengroup.org/onlinepubs/...ns/fileno.htmlthis would give the file descriptor using which you can call fstat() which also conforms to posix.
@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.
@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!!!
>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:
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.
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:
C Syntax (Toggle Plain Text)
typedef off64_t fpos_t; off64_t fseek64 ( FILE *file, off64_t offset, int whence ) { return _intern_seek ( stream, offset, whence ); }
New members chased away this month: 3
![]() |
Similar Threads
- Filesize limit on vfat ? (*nix Hardware Configuration)
Other Threads in the C Forum
- Previous Thread: sorting from a input text file
- Next Thread: Pasting together two 2d arrays into a new one
| Thread Tools | Search this Thread |
Tag cloud for C
#include ansi array arrays asterisks binarysearch calculate centimeter changingto char convert copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic fflush file fork forloop framework getlasterror givemetehcodez grade graphics gtkgcurlcompiling hacking hardware histogram homework inches include incrementoperators input iso kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. lowest match matrix microsoft motherboard multi mysql number opendocumentformat opensource owf pattern pdf performance pointer posix problem probleminc process program programming radix recursion recv repetition research reversing scanf scripting segmentationfault sequential shape socket socketprograming spoonfeeding standard string strings structures student systemcall testing threads turboc unix user variable voidmain() wab windows.h windowsapi






