• 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: Justin Walker <email@hidden>
  • Date: Fri, 20 May 2005 08:06:34 -0700


On May 20, 2005, at 5:45, Theodore H. Smith wrote:


This is a very basic question,

A bit off-topic for the Xcode list; if you are working on Unix-like-things, there's 'darwin-development'; there are other lists for GUI apps and higher-layer APIs (Cocoa, ...).


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?

For file info: man stat; man fstat.

For navigating the file system: man readdir; man dirent.

There are probably useful higher-layer APIs for doing the latter, depending on your goals, but I don't know them.

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.

Typically, you open a file, and read until you get an EOF indication. You don't need to know how much to read.


Also, typically, one doesn't have to look at *every* file in the file system, so one designs the program to take as input, e.g., on the command-line, a list of file names to be read or written.

Again, with higher-layer APIs, there may be alternatives. GUI apps usually present the user with a file dialog that lets the user do the navigating. The program then goes with the user's selection.

HTH.

Regards,

Justin


-- elfdata.com/plugin/ Industrial strength string processing, made easy.

"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."

_______________________________________________
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


--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
If you're not confused,
You're not paying attention
--------

_______________________________________________
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


References: 
 >Length of a file in C/C++ (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Various Key Binding Assignment Bugs and Restrictions
  • Next by Date: Subproject Dependencies
  • Previous by thread: Length of a file in C/C++
  • Next by thread: Re: Length of a file in C/C++
  • Index(es):
    • Date
    • Thread