• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Length of a file in C/C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Length of a file in C/C++


  • Subject: Re: Length of a file in C/C++
  • From: Javier Blanque <email@hidden>
  • Date: Fri, 20 May 2005 15:43:03 -0300

Also, you can use lseek to see the lenght of a file.

    #include <unistd.h>
    off_t lseek(int fildes, off_t offset, int whence);

you can say:

    file_lenght = lseek(my_file, 0, SEEK_END);

which is useful for "memory allocation purposes" in case you want to put your entire file in RAM. See man lseek at the console app.

Best regards,
Javier Blanque

El 20/05/2005, a las 09:45, Theodore H. Smith escribió:


This is a very basic question, but I've never needed to do this before anyhow. How do you tell the length of a file using standard C/C++ functions? And how do you navigate the file system with these functions also?


All the docs I've seen on fread/fopen and family don't mention anything about telling you how much data to read, or how to find out what files there are to read.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Length of a file in C/C++
      • From: Dan Saul <email@hidden>
References: 
 >Length of a file in C/C++ (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: How does the SDK selection affect my compiler settings?
  • Next by Date: Re: Length of a file in C/C++
  • Previous by thread: Re: Length of a file in C/C++
  • Next by thread: Re: Length of a file in C/C++
  • Index(es):
    • Date
    • Thread