Creating a program to read file size in Dos Environment

Hello Experts,

I would like to know how to create a program to read file size in dos environment. Your help will be much appreciated
dekoayAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
msa092298Connect With a Mentor Commented:
if you open the file using fhandle=fopen(...) , use filelength(fileno(fhandle)).
You can however do it without opening the file as follows:
/////////////////
_finddata_t findstructure;
long fsize=-1; // assume an error
long srchHandle = _findfirst( "yourFileNameAndPath", &fileinfo );
if (srchHandle!=-1)
{
   fsize=findstructure.size
   _findclose(srchHandle);
}
else // that file does not exist or not found.

//////////////////////////////
0
 
dekoayAuthor Commented:
Hi msa,
Thanx for the answer.... The point is yurs...
0
All Courses

From novice to tech pro — start learning today.