What you're looking for are pseudo terminals. See man pty
The BSD style ones are no longer supported; life was very easy with them. If you have an old distro (RH7 or so) they are still there. I personally find the unix98 style ones far more complicated.
Use tty0tty as indicated above; if you use the code from the linuxquestions link, it will throw a warning, so you might be better of with the sourceforge link (not checked).
wim@i3-2120:~/tty0tty$ gcc -Wall -O2 -D_GNU_SOURCE tty0tty.c -o tty0tty
tty0tty.c: In function ‘main’:
tty0tty.c:66:32: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
tty0tty.c:68:32: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
wim@i3-2120:~/tty0tty$ ls -l
-rwxrwxr-x 1 wim wim 8896 Oct 5 15:34 tty0tty
-rw-rw-r-- 1 wim wim 1075 Oct 5 15:34 tty0tty.c
Once you have an executable tty0tty, you can start it
(/dev/pts/2) <=> (/dev/pts/3)
Keep it running!
Use a terminal program (e.g minicom) to use one of the two (e.g /dev/pts/2). Use your application to use the other one (e.g. /dev/pts/3).
wim@i3-2120:~$ minicom -p /dev/pts/2
you might need to configure minicom so it does not send ATZ commands