diff options
author | Oskar <[email protected]> | 2024-10-05 14:23:02 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-10-05 14:23:02 +0200 |
commit | d5fcdab87a013b2c919b66ea9a52b469620ca49f (patch) | |
tree | d4f5018348d7d40b2ace6e01af3fb6803795f23e /tie-test.cpp | |
parent | 2f1ad9ec273a0ff9e746e9f6c4cac2ce81cb31e4 (diff) |
more
Diffstat (limited to 'tie-test.cpp')
-rw-r--r-- | tie-test.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tie-test.cpp b/tie-test.cpp new file mode 100644 index 0000000..8623316 --- /dev/null +++ b/tie-test.cpp @@ -0,0 +1,24 @@ +#include <iostream> + +/* + * + * + * + * + */ + +int main () { + + std::ostream *a = &std::cout; // get address of cout + std::ostream *b = std::cin.tie(&std::cout); // Tie cin and cout + std::ostream *c = std::cin.tie(); // return address of that cin is tied to (cout) + std::cin.tie(0); // Untie by giving null + std::ostream *e = std::cin.tie(); // Check if it's tied, should return null + std::cin.tie(c); // Tie it again to address pointed to by c + std::ostream *f = std::cin.tie(); // Check if it's tied. Should return same address as c or &std::cout + std::cout << a << "\n" << c << std::endl; + std::cout << e << "\n" << f << std::endl; + if(b) // compiler please be quiet + + return 0; +} |