mardi 30 août 2016

Why write() to STDIN worked?

I have the following code:

int main()
{
    char str[] = "Hellon";
    write(0, str, 6);   // write() to STDIN
    return 0;
}

When I compiled and executed this program, "Hello" was printed in the Terminal.

Why did it work, did write() replaced my 0 (STDIN) argument with 1 (STDOUT)?

Aucun commentaire:

Enregistrer un commentaire