Mail Archives: djgpp/1998/02/25/02:43:28
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 -