Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating a program to read file size in Dos Environment

Posted on 1998-10-14
2
Medium Priority
?
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

715 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