I have seen similar posts in stackoverflow and other sites but I cannot find solution to my problem.
I have the following consoleout.sh
file:
#!/bin/sh
#this way works in c:
#echo "Hello World!"
#but in function does not work:
a(){
echo "Hello World!"
}
Following C code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
system(". consoleout.sh");
system("a");
return 0;
}
Without system("./consoleout.sh")
, it works fine.