Problem when use getc function before creating a new process with execve()
Hello,
I am facing a strange problem.
I am using execve() to run a program with new enviornment variables.
before I call execve(), I have to read an input from the user.
When the user types the input, and i read it in my code using gets(); my program works fine, and execve calls other executable as expected.
But if instead of gets() I read user input using getc(), as in
do {
*(pDisp + iCnt++) = getc(stdin);
}while(*(pDisp + (iCnt - 1))!='\n');
then when execve() function is encountered in the code,
execve("./b.out",NULL,c);
It does nothing, it does not call my other executable code.
Any hints ?
|