I was trying to execute system calls from c. When the following code is executed, the date is printed first followed by " Todays date is ..........:"
on a new line. When I replaced printf
by puts, it executed as I intended.(the objdump
showed puts@plt in place of the second printf
). Can anybody tell me why it is so?
#include <stdlib.h>
int main() { printf(" Todays date is ..........:");
system("/bin/date");
printf("\n This is your exclusive shell\n");
system("/bin/sh");
return 0;
}
Thanks in advance.