In study course i need to use 2 programs in same time to writing strings in one file.
I typed two similar programs on C:
#include <stdio.h>
int main(int argc, char** argv)
{
FILE *f;
f = fopen("output.txt", "w+");
while (1)
{
fprintf(f, "%s", "kill me pls \n");
}
return 0;
}
and
#include <stdio.h>
int main(int argc, char** argv)
{
FILE *f;
f = fopen("output.txt", "w+");
while (1)
{
fprintf(f, "%s", " NO! \n");
}
return 0;
}
And then i compiled and tried to run this programs in same time, using command
./prog1 & ./prog2 &
But nothing happening. In console i saw:
stolz$ ./prog1 & ./prog2 &
[7] 3920
[8] 3921
How must i type shell command to run this programs in the same time?