NO

Author Topic: _makepath() implementation problem?  (Read 3354 times)

japheth

  • Guest
_makepath() implementation problem?
« on: June 17, 2009, 08:45:54 AM »

hello,

the following possible bug was found in v5.0. I didn't test it with v6rc2, but since I didn't find _makepath() mentioned in the change log shipping with v6 there may be a chance that it still occurs.

Problem: makepath() doesn't add filename and extension to the path.

Test case:

Code: [Select]
#include <stdio.h>
#include <stdlib.h>

char drive[] = {"\0"};
char dir[] = {"\\masm32\\include\\"};
char fname[] = {"windows"};
char ext[] = {".inc"};

int main()
{
    char fullpath[FILENAME_MAX];
    _makepath( fullpath, drive, dir, fname, ext );
    printf( "fullpath=%s\n", fullpath );
    return(0);
}

the resulting program displays:

fullpath=\masm32\include\

OTOH, with MS VC, the program displays:

fullpath=\masm32\include\windows.inc

which is what I do expect.


Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: _makepath() implementation problem?
« Reply #1 on: June 17, 2009, 11:04:02 AM »

Problem: makepath() doesn't add filename and extension to the path.


The runtime-lib from Pelle adds the filename to the path, but is a zero byte between path and name.

Until Pelle corrects his runtime you can link with msvcrt.lib and ignore the warning.  ;)
best regards
 Alex ;)

japheth

  • Guest
Re: _makepath() implementation problem?
« Reply #2 on: June 17, 2009, 02:40:26 PM »
The runtime-lib from Pelle adds the filename to the path, but is a zero byte between path and name.
Until Pelle corrects his runtime you can link with msvcrt.lib and ignore the warning.  ;)

Thanks! It's not a problem for me, since I can replace the RTL implementation with a "self-written" one.  Just wondering why such an issue hasn't been noticed before.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: _makepath() implementation problem?
« Reply #3 on: June 21, 2009, 12:57:20 PM »
Apparently no one is using _makepath() - which is probably a good thing. The function hasn't changed from the initial version 2005-07-18.
/Pelle

nicolas.sitbon

  • Guest
Re: _makepath() implementation problem?
« Reply #4 on: June 21, 2009, 01:10:32 PM »
I do use _makepath_s() from msvcrt.