hello xperts,
this ? follows the link
https://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20733105.html
the code i have is this....
#include<stdio.h>
#include<stdlib.h>
int main( void )
{
int ret = -1;
printf("Hello World.\n");
ret = system("dir > c://test1.txt");
printf(" my val is %d\n", ret);
ret = system(" c:\\h1.exe > c:\\wierd");
printf(" my val is %d\n", ret);
ret = system(" c:\\h1.exe >> c:\\wierd.txt");
printf(" my val is %d\n", ret);
system("pause");
system("cls");
// getchar();
printf("after");
return 0;
}
Iam trying to execute the above code in Windows
the thing is the re-direction is not happ. via system
But the re-direction takes place when i try it manually in the command prompt
the return value of all the above statements is 0.
As SunnyCoder had suggested in dat link.. i did have a huge code where the system was present in an if
but since things werent happ. i tried out d above sample code.
BTW is it got to do with the Library's way of implementing dis function?
But since this is a part of ANSI C library stdlib.h shudnt this be supported by all and shudnt the behavior be same
coz i have tried dis out in *nix b4 and i have never encountered problems like this
TIA
not_an_xpert :-(