 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jenkins Guest
|
Posted: Mon Jan 26, 2004 1:11 am Post subject: Newbie: Output window |
|
|
Sorry about the newbie question. I was beginning to study c/c++ in turbo c++
4.5 and just bought c++ builder personal 6.0. I was used to doing 'cout'
with <iostream.h>, etc. but am unable to view output in bcb6 for simple code
such as the following. How can I view output in bcb6? Do I need to change
the code, setup a certain form, set some option to view output or what?
Thanks!
doug
#include <iostream.h>
int main()
{
int var = 10;
int *ptr;
ptr = &var; // assign address of var to value of ptr
cout << "nValue of var: " << var; // value of var
cout << "nLocation of var: " << &var; // memory location where var is
stored
cout << "nValue of ptr: " << ptr; // memory location where var is
stored(since we assigned &var to ptr)
cout << "nLocation of ptr: " << &ptr; // memory location where ptr is
stored
cout << "nValue of *ptr: " << *ptr; // value of var(since we
assigned &var to ptr)
return 0;
}
|
|
| Back to top |
|
 |
OBones Guest
|
Posted: Mon Jan 26, 2004 1:44 am Post subject: Re: Newbie: Output window |
|
|
Jenkins wrote:
| Quote: | Sorry about the newbie question. I was beginning to study c/c++ in turbo c++
4.5 and just bought c++ builder personal 6.0. I was used to doing 'cout'
with <iostream.h>, etc. but am unable to view output in bcb6 for simple code
such as the following. How can I view output in bcb6? Do I need to change
the code, setup a certain form, set some option to view output or what?
Thanks!
|
You need to do a Console application.
Or if you want to output in a Memo, do this:
Memo->Lines.Add(content);
|
|
| Back to top |
|
 |
Ed Mulroy [TeamB] Guest
|
Posted: Mon Jan 26, 2004 1:47 am Post subject: Re: Newbie: Output window |
|
|
That is normal behavior. When a console mode program runs it asks Windows
to open a console in which it will do I/O. When the console mode program
ends Windows closes the console.
If you want to see the console window at the end of the program either place
a breakpoint on the return statement in main or add getchar(); on the line
before that return statement.
.. Ed
| Quote: | Jenkins wrote in message
news:40146948 (AT) newsgroups (DOT) borland.com...
Sorry about the newbie question. I was beginning to study c/c++
in turbo c++ 4.5 and just bought c++ builder personal 6.0. I was
used to doing 'cout' with <iostream.h>, etc. but am unable to
view output in bcb6 for simple code such as the following.
How can I view output in bcb6? Do I need to change the code,
setup a certain form, set some option to view output or what?
Thanks!
doug
#include
int main()
{
int var = 10;
int *ptr;
ptr = &var; // assign address of var to value of ptr
cout << "nValue of var: " << var; // value of var
cout << "nLocation of var: " << &var; // memory location where var
is
stored
cout << "nValue of ptr: " << ptr; // memory location where var
is
stored(since we assigned &var to ptr)
cout << "nLocation of ptr: " << &ptr; // memory location where ptr
is
stored
cout << "nValue of *ptr: " << *ptr; // value of var(since we
assigned &var to ptr)
return 0;
}
|
|
|
| Back to top |
|
 |
Buck Rogers Guest
|
Posted: Thu Feb 05, 2004 12:39 am Post subject: Re: Newbie: Output window |
|
|
<Want to view output from a console application>
I always have a dos window open, alongside BCB 6. That way, I compile the
code, then switch to the DOS window and run the application from the
command
line. You can set it so that the DOS window defaults to a particular folder
(where your programs are stored) so that you can just launch the program
as soon as the DOS window is opened. It works great.
Buck
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|