Solved

Creating a program to read file size in Dos Environment

Posted on 1998-10-14
2
160 Views
Last Modified: 2010-04-02
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
0
Comment
Question by:dekoay
2 Comments
 
LVL 1

Accepted Solution

by:
msa092298 earned 10 total points
ID: 1175198
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
 

Author Comment

by:dekoay
ID: 1175199
Hi msa,
Thanx for the answer.... The point is yurs...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now