www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/25/10:54:57

Date: Wed, 25 Feb 1998 17:52:49 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Dim Zegebart <zager AT post DOT comstar DOT ru>
cc: DJGPP Mail List <djgpp AT delorie DOT com>
Subject: Re: Funny thing with _fixpath
In-Reply-To: <34F3CBC1.7066@post.comstar.ru>
Message-ID: <Pine.SUN.3.91.980225174658.2648S-100000@is>
MIME-Version: 1.0

On Wed, 25 Feb 1998, Dim Zegebart wrote:

>   _fixedpath(ini_name,fixed_name);
> 
> // What do you thinking about contents of fixed_name now ? Yes, I also
> think it's just 'my_ini.ini'

Wrong!

> // But the real contents after _fixedpath is :
> 'c:/djgpp/contrib/mywork/my_ini.ini' exactly where from I running my exe
> file !

That's exactly what `_fixpath' is supposed to do.  It canonicalizes the 
file name.  ``Canonicalizing'' means that it adds the drive and the 
current directory, if they aren't already there, and resolves "." and 
".." if present.  It also does other useful things, like converting all 
slashes to forward variety; see the libc docs.

What exactly is the problem?

> But, how I should allocate space for fixed_name exept declaring it as
> 'char fixed_name[MAXDIR]' ?

Either
	char fixed_path[FILENAME_MAX];
or
	char fixed_path[PATH_MAX];

The first is ANSI C (defined on stdio.h), the second is POSIX (defined in 
limits.h).

- Raw text -


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