Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating a program to read file size in Dos Environment

Posted on 1998-10-14
2
Medium Priority
?
174 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 40 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

926 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