I noticed that with version 5.5 "strcmp" doesn't accept argument if it is
NULL, it report error problem, is there another equivalent function??
the following program cause error if launched without any argument, if
compiled with version 5.2 or older, it works
Thanks
Maurice
////////////////////////////////////////////////////////////////////
#include "stdio.h"
#include "string.h"
main(int argc, char *argv[])
{
if(!strcmp(argv[1],"hello")) printf(" hi\n");
else printf("bye\n");
}
////////////////////////////////////////////////////////////////////
> I noticed that with version 5.5 "strcmp" doesn't accept argument if
> it is NULL, it report error problem,
Correct. invoking strcmp() with one or two NULL pointers causes the
program to have undefined behavior.
> is there another equivalent function??
Well, you can always write one of your own.
> the following program cause error if launched without any argument, if
> compiled with version 5.2 or older, it works
>
> Thanks
> Maurice
>
> ////////////////////////////////////////////////////////////////////
> #include "stdio.h"
> #include "string.h"
>
> main(int argc, char *argv[])
> {
> if(!strcmp(argv[1],"hello")) printf(" hi\n");
> else printf("bye\n");
> }
The obvious solution is to check argc first.
If you must use a NULL argument then use the Windows function lstrcmp.
. Ed
> Maurice wrote in message
> news:47bd...@newsgroups.borland.com...
Thank you
Maurice