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

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Funny thing with _fixpath
Date: Wed, 25 Feb 1998 15:45:07 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 37
Message-ID: <34F42E73.598EA946@LSTM.Ruhr-UNI-Bochum.De>
References: <34F3CBC1 DOT 7066 AT post DOT comstar DOT ru>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Dim Zegebart wrote:
> 
> Hi,
> I just found a very interesting feature of _fixpath, look :
[...]
> 
> Perhaps, this is a special feature of _fixedpath (perhaps, usefull for
> somebody) ...
> But, how I should allocate space for fixed_name exept declaring it as
> 'char fixed_name[MAXDIR]' ?

I think this is an (undocumented) feature. You should
_NEVER_ rely on _fixedpath returning the same length as
the string you feed in. IIRC, it internally calls 
_truename(), and that one prepends the current working directory
if it is not there, so you get a fully qualified pathname. 
Better use
 char fixed_name = (char*) malloc(MAXNAME);
(I think MAXNAME is the maximum len including
drive and path, cross check that).



-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


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