delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/09/14/09:15:45

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <432821e9$0$177$cc7c7865@news.luth.se>
From: Martin Str|mberg <ams AT speedy DOT ludd DOT ltu DOT se>
Subject: Re: Help with Dos errors
Newsgroups: comp.os.msdos.djgpp
References: <000201c5b929$9702fbc0$ae7ba8c0 AT JPS DOT local>
User-Agent: tin/1.4.6-20020816 ("Aerials") (UNIX) (NetBSD/1.6Q (alpha))
Date: 14 Sep 2005 13:13:13 GMT
Lines: 52
NNTP-Posting-Host: speedy.ludd.ltu.se
X-Trace: 1126703593 news.luth.se 177 130.240.16.13
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Benjamin Belisle <bbelisle AT jpselectronique DOT com> wrote:
> Thank you for your responses.
> My function that writes on the diskette looks a bit like this:

> 	if (F_Open ("a:\\agrimtl2.ini", WRITE)) {
> 		return 1;
> 		}
> 	else {
> 	   	EcrireINI ();
> 		F_Close ();
> 		}

Are those lines above supposed to be fopen and fclose? Assuming so and
that ExrireINI() does fprintf or similar, you need to check those
return values as well.

> 	sprintf (Buff, "a:\\%u.txt", Annee);
> 	Fichier = fopen (Buff, "wb");
> 	if (Fichier == NULL) {
> 		return 1;
> 		}
> 	else {
> 	... And so on
> so yes I do verify the return values.

Yes, you show us that you check fopen()'s return value (in this
case). How about fclose() and fprintf()'s?

> But I also want to know why it failled, the possible error codes (_doserrno)
> when writing on (a:) are:

> Which is why I do:

> 	if(_doserrno > 18 && _doserrno < 40)
>  	{
>     		DosError = 1;
>   		TypeDosError = _doserrno-19;
>   	}

What's wrong with errno?

> And again, works fine in Windows (which I've heard has a much better DPMI
> host than CWSDPMI).

No. It's a much worse DPMI server. 1. It doesn't support detecting
NULL dereferences. 2. For each new release of WINDOWS, there are a new
bunch of bugs that the DJGPP libc has to work-around.


Right,

						MartinS

- Raw text -


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