Reputation: 4224
how to send return(enter button) character through program in windows c/c++? I want to send an external program "user name" with enter button through pipe but "\n" and "\r" and EOF are not working.
consider if pPipe is the pipe stream for sending the data to the remote process stdin...
fprintf(pPipe,"username\n");
Upvotes: 0
Views: 446
Reputation: 753585
You need to flush the data out of the I/O package buffers.
If you're using <cstdio>
(or <stdio.h>
) as shown, then:
fflush(fp);
Upvotes: 0