_makepath() implementation problem?

Started by japheth, June 17, 2009, 08:45:54 AM

Previous topic - Next topic

japheth


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:


#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.


AlexN

Quote from: japheth on June 17, 2009, 08:45:54 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

Quote from: AlexN on June 17, 2009, 11:04:02 AM
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.

Pelle

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