Also look at FileGetAttr.
James P. Cottingham
When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity. [tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
I had this program so I just copied
long FileSize (FILE *stream)
{
long length, curpos;
fseek (stream, 0L, SEEK_END);
length = ftell(stream);
fseek (stream, 0L, SEEK_SET);
return length;
}
//----------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
FILE *handle;
AnsiString Nombre = FileListBox1->FileName;
AnsiString Tamanio;
handle = fopen(Nombre.c_str(), "r"
Tamanio = AnsiString (FileSize (handle));
Nombre = StrCat (Tamanio.c_str(), " Bytes"
Label1->Caption = Nombre.c_str();
fclose(handle);
}
I hope it help you
A lot of different methods, but mind that in some cases the file can be located on a network. Without read rights it is not possible to open the file.
In those cases you will need FileGetAttr
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.