Pipe communication Related

Hi all

My question is related to pipe communication.

If we open up a terminal or cmd and write a command then press enter, if command is valid, we should receive a proper output. The steps are: write the command->press enter

Now the question is when i write a command through pipe. Do i need to add something to the end of command string. For example:

Linux

1
2
const char * str = "Hello";
uint32_t BytesWritten = write(pipes[1], str , strlen(str));


And for Windows

1
2
3
const char * str = "Hello";
uint32 BytesWritten = 0;
bool bIsWritten = !!WriteFile(WritePipe, str , strlen(str), (::LPDWORD)&BytesWritten, nullptr);


In these codes, do i need to add anything like '\0' or '\r' as a postfix to the str string. Or just sending the strings will do the work?

Hope i explained what i had on my mind. Thanks in advance.
Last edited on
Funny, there was no need to think complicatedly. All i needed was '\n' :)
Topic archived. No new replies allowed.