delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/02/09:47:03

Message-Id: <199801021427.QAA03702@ankara.duzen.com.tr>
Comments: Authenticated sender is <mitch AT ankara DOT duzen DOT com DOT tr>
From: "S. M. Halloran" <mitch AT duzen DOT com DOT tr>
Organization: User RFC 822- and 1123-Compliant
To: djgpp AT delorie DOT com
Date: Fri, 2 Jan 1998 16:28:58 +0200
MIME-Version: 1.0
Subject: Re: Somethings wrong 2!!!!
In-reply-to: <34AB8E47.473BA8A1@usa.net>

On  1 Jan 98, Rune Lanton was found to have commented thusly:

> 
> OK, first I wrote this program that reads one file, using the
> code:'file_pointer = fopen(arg_pointers[1],"rb");'
> But then I found out I wanted my program to be able to read all files of
> a given type, like all .htm files, or all .txt files.
> So I found the functions findfirst and findnext, aha, perfect. So I
> wrote this into my program->'status = findfirst(search_wild,
> fileinfo,FA_HIDDEN);'
> Status I just to determine whenthere's no more files.
> The problem is, when I wrote this into my program, just in front of the
> fopen funtion, fopen suddenly would.nt work anymore, it just crashes
> when it gets there. Why???

You need to show more code.

You probably have not initialized a pointer or are sending a variable 
as an argument rather than the address of a variable.  For example, 
as I remember, FILEINFO is structure defined by MS-DOS and, not 
coincidentally, implemented as a structure by people who write 
libraries for MS-DOS.  People usually pass pointers to structures 
rather than the structures themselves (apologies to C++ crowd) as 
arguments to functions.  Perhaps the 'fileinfo' in your 2nd arg to 
findfirst is a pointer to a structure, in which case you have 
probably failed to initialize it;  perhaps 'fileinfo' is defined as 
the structure itself, in which case you should probably be passing 
its address.  I would know more about 'fileinfo' and other symbols in 
your code, of course, if I saw the relevant block of code.  (I 
promise not to use the code you post to make a profit...Scout's 
honor  ;-)

> 
> I hope I was a little bit clearer this time.

Well....maybe a little bit, I guess.
 
> lanton AT c2i DOT net
> 
 

Mitch Halloran
Research (Bio)chemist
Duzen Laboratories Group
Ankara   TURKEY
mitch AT duzen DOT com DOT tr

other job title:  Sequoia's (dob 12-20-95) daddy

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019