×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

constream

constream

constream

(OP)
Hi, I'm writing a program in C++, compiling using the free Borland 5.5, and I'm writing it with DOS as my target OS (hopefully for the last time :) ).  I have need for text colors and text windows, and I discovered the constream type, which seems to work fine, except when I input.  When I input, I'm currently using cin >>, and the next thing I output always gets output on the left edge of the screen, ignoring the window's restraints.  I've included a simple program that demonstrates what I mean.  How do I make it so the output is within the window?  Thanks a lot...

#include <iostream.h>
#include <constrea.h>

int main()
{
  int x;
  constream cout;
  cout.window(2,2,79,24);
  cout.clrscr();
  cout << "Test\n";
  cin >> x;
  cout << "Test 2\n";
  return 0;
}

The "Test 2" gets output as if there were no window.
???

RE: constream

I think the problem is that cin takes its input from the standard window. Your next call to cout sends its output to the same window that cin used. Instead of trying to name your new window cout what happens when you name it something like Mycout? I don't have access to my 5.5 compiler to test this.

James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close