Solved

Creating a program to read file size in Dos Environment

Posted on 1998-10-14
2
164 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

756 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