Jump to content

File Properties

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
bladactania

bladactania

    Newbie

  • Members
  • PipPip
  • 10 posts
Is it possible to retrieve file stats, like size (in bytes)? If so, how?

I'm reading in a text file and I want to display the % that has been read so far.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It will depend on the OS you are working in.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
bladactania

bladactania

    Newbie

  • Members
  • PipPip
  • 10 posts
Linux

#4
vineel

vineel

    Newbie

  • Members
  • Pip
  • 4 posts
the following is the platform independent way of getting the file size

FILE*fp = fopen("hackme.dat","r");
int size;
size = fseek(fp,0,SEEK_END);


fseek returns the current byte position in the file..........
using this fact i am moving zero bytes ahead from end of file ;) which returns the byte position of end of file => file size..........
give a try.....

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Good help, +rep given.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums