my program is meant to fork a process, read from a file line by line within the parent and shove these lines down a pipe to be passed to bc which is called using execve.
The file I am using is a text file that simply contains 5 + 10.
Parent process reads 'em in like this:
while(fgets(newWord, sizeof newWord, coolFile) != NULL)
{
write(stdin_pipe_fds[1], newWord, (strlen(newWord)+1));
}
Child calls bc like this:
execve("/usr/bin/bc", argv, NULL);
Running the program gives me this error message:
scg3q@system64:~/CS/project4$ (standard_in) 1: syntax error
(standard_in) 1: illegal character: ^@
(standard_in) 1: syntax error
This happens when I try to execve bc. Any ideas?
EDIT: making sure the null terminator is not passed to bc via the pipe fixes one error message(Illegal character), but the other two remain. Hoping someone has an idea of the problem could be!