name>vi t.c
#include <stdio.h>

int main(void){
 char c[256];
 printf(">");
 gets(c);
 //fgets(c,256,stdin);
 printf("%s",c);
 return 0;
}

name>gcc t.c
/tmp/cc4hr3hR.o: In function `main':
t.c:(.text+0x1d): warning: the `gets' function is dangerous and should not be used.
name>./a.out
>(ctrl+z)
中断
name>fg
./a.out
a
a
name>

c++じゃないけど。
ctrl+zの制御って、結構深いところまで潜らないと奪えなかったりしないのかなぁ、知らない。