Results 1 to 5 of 5

Thread: get file size

  1. #1

    Thread Starter
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330

    get file size

    is there a function built into C++ or in the API to determine the size of a txt file? Thanks
    Matt

  2. #2
    denniswrenn
    Guest
    you can use filelength() in io.h, but you must provide a file handle (open() the file)...

  3. #3
    Megatron
    Guest
    Use the GetFileSize API

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    _stat is part of the standard library.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Or you can use the fseek() function with the SEEK_END paramater to move the file pointer to the end of the file and then get the pointer's position using the ftell() function. The position is the file size in bytes.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width