Thread: How to get file size in C++?

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    29

    How to get file size in C++?

    IŽd like to read in some bytes from a file, but first I need to know the file size. How does one do that in C++?

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One solution is seekg(0, std::end) and tellg().

    Kuphryn

  3. #3
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343
    Minor correction
    Code:
    seekg(0, ios::end);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM