I know this is a simple one, still I’m too sleepy to figure it out.
Can someone help me?
char buf1[] = "one second program started\n";
char buf2[] = "one second program end\n";
int main(void)
{
write(1,buf1,100);
sleep(1);
write(1,buf2,100);
}
I need the first statement printed, then after a unit wait, the second statement to be printed. But, when I execute this, both the statements are printed, then a unit wait and the second statement is printed twice. Where am I going wrong?
Change
100tostrlen(buf1)orstrlen(buf2).