[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

File List

Posted on 2000-02-28
6
Medium Priority
?
202 Views
Last Modified: 2010-04-15
I need a small routine to grab a file list in a know directory and check the size of each file.  If the size is greater than 0KB, flag an error.

This routine will check error file being generated by a compiler.

-Kevin

I'm sorry,  the code is for DOS based systems.  I don't need anything fancy.  I just need somthing like

do {
    handle = open ("\\debug\\*.err");  /* need to open multiple files */
    fs = filelength(handle);
    if (fs == 0) {
         error;
    }
while (/* still have files in directory*/);

No GUI can be used.  This executable will called from within a batch file.

-Kevin
0
Comment
Question by:kph1
[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
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 2565243
For what OS?
0
 

Author Comment

by:kph1
ID: 2565329
Edited text of question.
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 2565547
Hi kph1,

If you call it from a batch file you could easily use batch command 'FOR', i.e.

FOR %i in ("\debug\*.err") do call MyCheckLength.exe %i

and make a application 'MyCheckLength.exe' which get's one filename and checks its size.

If you need to do it from a C program you should try to find something like _findfirst, _findnext and _findclose (cannot remember if these are the exact function names for DOS).

ZOPPO
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 22

Accepted Solution

by:
cookre earned 200 total points
ID: 2565810
char    TmpPath[256];
struct  find_t FileInfo;

strcpy(TmpPath,"\\debug\\*.err");
if (0==DOSFindFirstFile(TmpPath,_A_NORMAL|_A_HIDDEN|_A_SYSTEM,&FileInfo))
   {
   if (FileInfo.size==0) {Do error stuff}
      }
   while (0==DOSFindNextFile(&FileInfo))
         {
         if (FileInfo.size==0) {Do error stuff}
         }
   }
0
 
LVL 22

Expert Comment

by:cookre
ID: 2565823
Sorry 'bout that - get rid of the first right curly brace.
0
 

Author Comment

by:kph1
ID: 2565877
Thank you.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

650 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