cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/25/02:43:28

Message-ID: <34F3CBC1.7066@post.comstar.ru>
Date: Wed, 25 Feb 1998 10:44:01 +0300
From: Dim Zegebart <zager AT post DOT comstar DOT ru>
Reply-To: zager AT post DOT comstar DOT ru
Organization: Comstar Ltd.
MIME-Version: 1.0
To: DJGPP Mail List <djgpp AT delorie DOT com>
Subject: Funny thing with _fixpath

Hi,
I just found a very interesting feature of _fixpath, look :

void foo(void)
{
  load_setting("my_ini.ini");
}

int load_settings(char *ini_name)
{
  char fixed_name=(char*)malloc(strlen(ini_name)+1); //suppose
strlen("my_ini.ini")==10, malloc allocate 11 byte in data segement
  
  _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'
// But the real contents after _fixedpath is :
'c:/djgpp/contrib/mywork/my_ini.ini' exactly where from I running my exe
file !
// As you can see the strlen(fixed_name) is something about 1,2,..., 34
! A bit greater then initial 11 ;)
// So, you may imagine how often I saw a GPF and SIGSEGV screens.
//(BTW, under plain DOS and CWSDPMI I can't trace this code with RHIDE,
only under NT)
}

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]' ?

Thank you.
-- 
____ ____ 
|   \   /   Dim Zegebart
____/____   

Moscow Russia
WWW - http://www.geocities.com/siliconvalley/pines/7817
DZcomm - comm library for Allegro
Palantir - multytasking kernel for Allegro (based on PDMLWP)

- Raw text -


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