What is the point of this atty function

closed account (4ET0pfjN)
Hi, I need to write a simple crytographic function and in the main file that calls the crypt function I need to write, the last set of statements is an if statements as such:

if(isatty(fileno(stdout)))
cout << endl;

so I read up and isatty is to indicate the file descriptor that is returned:
0 - stdin, 1 - stdout, 2 - stderr, but what is the purpose in terms of this cryptographic program I am supposed to write.

It does not matter. It's just to avoid artifacts in the output
foo@bar:~$ ./crypto.bin
Encrypted text
foo@bar:~$
foo@bar:~$ ./crypto.bin > file
foo@bar:~$ cat file
Encrypted textfoo@bar:~$
The file will not end with an empty line

Edit: The example run was incorrect
Last edited on
Topic archived. No new replies allowed.