I am trying to perform a write() to stdout in Linux using a program in C.
The problem I have encountered is that this is possible before the execlp() function, but after I try to display a file in hex format with execlp() this is somehow interefering with the output making it impoissible to write anything.
Here is the code I am using:
int main(int argc, const char* const argv[])
{
if(write(1, "OKAY", sizeof("OKAY")) == -1)
{
errx(1, "NOT OKAAY");
}
if(execlp("hexdump", "hexdump", "-v", "-e" , "/1 \"%04X\n\"", argv[1], (char*) NULL) == -1)
{
errx(1, "Unsuccessfull execlp");
}
if(write(1, "OKAY", sizeof("OKAY")) == -1)
{
errx(1, "NOT OKAAY");
}
So, the first write is working correctly, then the execlp has proper output as well, and here comes the trouble with displaying the second write.
Thank you!