I'm trying to use NodeJS with a C program to http://en.wikipedia.org/wiki/Setvbuf for JS files using Fork().
My program.c :
int readTabStr(int k)
{
char * tabString[] = {"p1.js","p2.js","p3.js","p4.js"};
int taille = sizeof(tabString)/sizeof(char);
int i;
for(i=0; i<taille; i++)
{
if (fork() == 0)
{
execlp("node","node", tabString[i], NULL);
}
else
{
wait(NULL);
}
}
return 0;
}
I'm using this JS file to launch the C file:
var FFI = require("../../lib/ffi");
var test = new FFI.Library("./readTab", {
"readTabStr": ["int", ["int" ]]
});
var resultat = test.readTabStr(0);
The problem is that after executing the p1.js, p2.js, p3.jsn p4.js. I get 4 error messages :
node.js:116 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module '/home/fighter/Documents/ffi/kerrighed/execlp/��$[]�U `enter code here`��E��E��U��S������1�' at Function._resolveFilename (module.js:299:11) at Function._load (module.js:245:25) at Array.<anonymous> (module.js:402:10) at EventEmitter._tickCallback (node.js:108:26)
Any ideas?