So I have opened a file with the "open" command and I get a file descriptor. That means I have to use lseek rather than fseek, which is fine by me. But what if I want to know how long the file is or what if I want to know where I am pointing. If I had a FILE*, I could use ftell. But I don't, so what do I use? ltell appears to not exist. Any ideas or alternatives? I need to bounce all over this file and write things, so I'd like to know where I am. Thanks.
VernonDozier
2,218
Posting Expert
Featured Poster
Recommended Answers
Jump to PostWhy are you using low-level file i/o?? Just use FILE* and all will be ok. The only reason to use open() is when the compiler for the target operating system doesn't have FILE* and associated functions.
Jump to PostJust curious, is there a reason why you need to bounce around in the file? Is it such a large file that it can't be loaded to RAM? Why not use file mapping to map it to a series of struct's or arrays of struct's so you dont ever need …
All 5 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
N1GHTS
102
Posting Whiz in Training
sree_ec
10
Junior Poster
VernonDozier
2,218
Posting Expert
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.