By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

just started

P: n/a
Just started to teach myself C C++ programming... I have been very
interested with computers for a while now and have a nac or so I
thought for how they work ... hardware I am ok with ... I can
understand and tear it down and rebuild it ... chips boards I/O etc
etc ... programing is a different beast ...

So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...

My question is this ... is there a way in C or C++ to write this into
the test.exe I made that simply shows "my name is .... "

This is where I am a total newb and have no idea where to go ... I
don't see any reference to a switch or execute in any of the library
files ... the stdio.h or stdlib.h ... i don't see where i can say

the directory is C:\windir
the program is C:\windir\default
the program has a properties tab
the properties tab has Misc, etc etc ...
the misc tab has an option for "close on exit"
the "close on exit" should be false

I have no idea really ... i don't even know if it possible ... maybe
it's better to just reg hack it and save the batch file ...

Any ideas ? or I am way the hell off base ? :) !

Jan 28 '07 #1
Share this Question
Share on Google+
11 Replies


P: n/a
st************@gmail.com wrote:
>
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...
Looks like you'd be better of posting to a windows programming group, or
one for your compiler.

--
Ian Collins.
Jan 28 '07 #2

P: n/a
The simplest way to keep the DOS window from closing automatically is
to use the following command:

system("pause");

place this command just before the return 0; in your main function.
this will issue a pause command to the terminal and will wait until
input to continue.
(I'm not sure i fully understand your questions...so I apologize if
this is completely off topic.)

On Jan 27, 11:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
sterling.mc...@gmail.com wrote:
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...Looks like you'd be better of posting to a windows programming group, or
one for your compiler.

--
Ian Collins.
Jan 28 '07 #3

P: n/a
lol I am not sure I fully understand the questions either :)
I am curious about programming and wanted to see what and where to
start ... so I got some info on C C++ and then made a simple file ...
set some varibles etc ...

but when I noticed that the dos window open and closed instantly I was
again just curious ... I mean in windows all I had to do was go to c:
\windir\default and choose the properties and deselect the check box
to close on exit ... and then started to wonder if I could incorperate
this into the script with C C++ commands ...

maybe I need to look into Visual C++ to interact with Windows ...
again I am not sure just curious is all
On Jan 28, 1:07 am, "LoKi" <neilgr...@gmail.comwrote:
The simplest way to keep the DOS window from closing automatically is
to use the following command:

system("pause");

place this command just before the return 0; in your main function.

this will issue a pause command to the terminal and will wait until
input to continue.
(I'm not sure i fully understand your questions...so I apologize if
this is completely off topic.)

On Jan 27, 11:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
sterling.mc...@gmail.com wrote:
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...Looks like you'd be better of posting to a windows programming group, or
one for your compiler.
--
Ian Collins.
Jan 28 '07 #4

P: n/a
try running this code:
#include <iostream>
using namespace std;

int main()
{
cout << "Hi my name is John Doe" << endl;

cout << '\n';
system("pause"); //this command is used to pause the terminal window
return 0;
}

On Jan 28, 12:18 am, sterling.mc...@gmail.com wrote:
lol I am not sure I fully understand the questions either :)
I am curious about programming and wanted to see what and where to
start ... so I got some info on C C++ and then made a simple file ...
set some varibles etc ...

but when I noticed that the dos window open and closed instantly I was
again just curious ... I mean in windows all I had to do was go to c:
\windir\default and choose the properties and deselect the check box
to close on exit ... and then started to wonder if I could incorperate
this into the script with C C++ commands ...

maybe I need to look into Visual C++ to interact with Windows ...
again I am not sure just curious is all

On Jan 28, 1:07 am, "LoKi" <neilgr...@gmail.comwrote:
The simplest way to keep the DOS window from closing automatically is
to use the following command:
system("pause");
place this command just before the return 0; in your main function.
this will issue a pause command to the terminal and will wait until
input to continue.
(I'm not sure i fully understand your questions...so I apologize if
this is completely off topic.)
On Jan 27, 11:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
sterling.mc...@gmail.com wrote:
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...Looks like you'd be better of posting to a windows programming group, or
one for your compiler.
--
Ian Collins.
Jan 28 '07 #5

P: n/a
Ok so ... please understand that I am completely new at this and I am
learning as I go ... I have read page after page but I learn when I am
testing stuff and actually doing/trying things out.

That code will not compile in the Miracle C application that I dl'ed
for testing ... so does that mean that I need a different compiler ?
if so what is a good one to start with ?

On Jan 28, 1:23 am, "LoKi" <neilgr...@gmail.comwrote:
try running this code:

#include <iostream>
using namespace std;

int main()
{
cout << "Hi my name is John Doe" << endl;

cout << '\n';
system("pause"); //this command is used to pause the terminal window
return 0;

}On Jan 28, 12:18 am, sterling.mc...@gmail.com wrote:
lol I am not sure I fully understand the questions either :)
I am curious about programming and wanted to see what and where to
start ... so I got some info on C C++ and then made a simple file ...
set some varibles etc ...
but when I noticed that the dos window open and closed instantly I was
again just curious ... I mean in windows all I had to do was go to c:
\windir\default and choose the properties and deselect the check box
to close on exit ... and then started to wonder if I could incorperate
this into the script with C C++ commands ...
maybe I need to look into Visual C++ to interact with Windows ...
again I am not sure just curious is all
On Jan 28, 1:07 am, "LoKi" <neilgr...@gmail.comwrote:
The simplest way to keep the DOS window from closing automatically is
to use the following command:
system("pause");
place this command just before the return 0; in your main function.
this will issue a pause command to the terminal and will wait until
input to continue.
(I'm not sure i fully understand your questions...so I apologize if
this is completely off topic.)
On Jan 27, 11:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
sterling.mc...@gmail.com wrote:
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...Looks like you'd be better of posting to a windows programming group, or
one for your compiler.
--
Ian Collins.
Jan 28 '07 #6

P: n/a
I would suggest getting a new complier/environment.

a group called bloodshed has made what they call dev C++.

Follow this link:
http://www.bloodshed.net/dev/devcpp.html

and be sure to download version 5 (this is still a beta version, but
very stable)

On Jan 28, 12:32 am, sterling.mc...@gmail.com wrote:
Ok so ... please understand that I am completely new at this and I am
learning as I go ... I have read page after page but I learn when I am
testing stuff and actually doing/trying things out.

That code will not compile in the Miracle C application that I dl'ed
for testing ... so does that mean that I need a different compiler ?
if so what is a good one to start with ?

On Jan 28, 1:23 am, "LoKi" <neilgr...@gmail.comwrote:
try running this code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hi my name is John Doe" << endl;
cout << '\n';
system("pause"); //this command is used to pause the terminal window
return 0;
}On Jan 28, 12:18 am, sterling.mc...@gmail.com wrote:
lol I am not sure I fully understand the questions either :)
I am curious about programming and wanted to see what and where to
start ... so I got some info on C C++ and then made a simple file ...
set some varibles etc ...
but when I noticed that the dos window open and closed instantly I was
again just curious ... I mean in windows all I had to do was go to c:
\windir\default and choose the properties and deselect the check box
to close on exit ... and then started to wonder if I could incorperate
this into the script with C C++ commands ...
maybe I need to look into Visual C++ to interact with Windows ...
again I am not sure just curious is all
On Jan 28, 1:07 am, "LoKi" <neilgr...@gmail.comwrote:
The simplest way to keep the DOS window from closing automatically is
to use the following command:
system("pause");
place this command just before the return 0; in your main function.
this will issue a pause command to the terminal and will wait until
input to continue.
(I'm not sure i fully understand your questions...so I apologize if
this is completely off topic.)
On Jan 27, 11:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
sterling.mc...@gmail.com wrote:
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...Looks like you'd be better of posting to a windows programming group, or
one for your compiler.
--
Ian Collins.
Jan 28 '07 #7

P: n/a
(scroll down on the page I sent you, you will find the download link)

On Jan 28, 12:32 am, sterling.mc...@gmail.com wrote:
Ok so ... please understand that I am completely new at this and I am
learning as I go ... I have read page after page but I learn when I am
testing stuff and actually doing/trying things out.

That code will not compile in the Miracle C application that I dl'ed
for testing ... so does that mean that I need a different compiler ?
if so what is a good one to start with ?

On Jan 28, 1:23 am, "LoKi" <neilgr...@gmail.comwrote:
try running this code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hi my name is John Doe" << endl;
cout << '\n';
system("pause"); //this command is used to pause the terminal window
return 0;
}On Jan 28, 12:18 am, sterling.mc...@gmail.com wrote:
lol I am not sure I fully understand the questions either :)
I am curious about programming and wanted to see what and where to
start ... so I got some info on C C++ and then made a simple file ...
set some varibles etc ...
but when I noticed that the dos window open and closed instantly I was
again just curious ... I mean in windows all I had to do was go to c:
\windir\default and choose the properties and deselect the check box
to close on exit ... and then started to wonder if I could incorperate
this into the script with C C++ commands ...
maybe I need to look into Visual C++ to interact with Windows ...
again I am not sure just curious is all
On Jan 28, 1:07 am, "LoKi" <neilgr...@gmail.comwrote:
The simplest way to keep the DOS window from closing automatically is
to use the following command:
system("pause");
place this command just before the return 0; in your main function.
this will issue a pause command to the terminal and will wait until
input to continue.
(I'm not sure i fully understand your questions...so I apologize if
this is completely off topic.)
On Jan 27, 11:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
sterling.mc...@gmail.com wrote:
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...Looks like you'd be better of posting to a windows programming group, or
one for your compiler.
--
Ian Collins.
Jan 28 '07 #8

P: n/a
nice ... thanks for the heads up on this compiler ... I'll do some
research on it and see what I can see :) Thanks again bro !! If you
have any fav news groups or sites with info that could help a new guy
out lemme know.

/salute

On Jan 28, 1:36 am, "LoKi" <neilgr...@gmail.comwrote:
(scroll down on the page I sent you, you will find the download link)

On Jan 28, 12:32 am, sterling.mc...@gmail.com wrote:
Ok so ... please understand that I am completely new at this and I am
learning as I go ... I have read page after page but I learn when I am
testing stuff and actually doing/trying things out.
That code will not compile in the Miracle C application that I dl'ed
for testing ... so does that mean that I need a different compiler ?
if so what is a good one to start with ?
On Jan 28, 1:23 am, "LoKi" <neilgr...@gmail.comwrote:
try running this code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hi my name is John Doe" << endl;
cout << '\n';
system("pause"); //this command is used to pause the terminal window
return 0;
}On Jan 28, 12:18 am, sterling.mc...@gmail.com wrote:
lol I am not sure I fully understand the questions either :)
I am curious about programming and wanted to see what and where to
start ... so I got some info on C C++ and then made a simple file ...
set some varibles etc ...
but when I noticed that the dos window open and closed instantly I was
again just curious ... I mean in windows all I had to do was go to c:
\windir\default and choose the properties and deselect the check box
to close on exit ... and then started to wonder if I could incorperate
this into the script with C C++ commands ...
maybe I need to look into Visual C++ to interact with Windows ...
again I am not sure just curious is all
On Jan 28, 1:07 am, "LoKi" <neilgr...@gmail.comwrote:
The simplest way to keep the DOS window from closing automatically is
to use the following command:
system("pause");
place this command just before the return 0; in your main function.
this will issue a pause command to the terminal and will wait until
input to continue.
(I'm not sure i fully understand your questions...so I apologize if
this is completely off topic.)
On Jan 27, 11:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
sterling.mc...@gmail.com wrote:
So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...Looks like you'd be better of posting to a windows programming group, or
one for your compiler.
--
Ian Collins.
Jan 28 '07 #9

P: n/a
* st************@gmail.com:
Just started to teach myself C C++ programming... I have been very
interested with computers for a while now and have a nac or so I
thought for how they work ... hardware I am ok with ... I can
understand and tear it down and rebuild it ... chips boards I/O etc
etc ... programing is a different beast ...

So I am fooling around with C and compile a small .exe file with
Miracle C ... simple thing that said Hi my name is etc etc ... but I
noticed that it loads in a dos window ... Why doesn't it load in
a .txt file ? My main question is this ... after you run the test.exe
it flashes open the DOS window and closes quickly ... now this I
understand ... I do have my MCE and I am trained in Windows XP tech
support ... I know that a "close on exit" command is "checked" for the
application and I know to just open the default properties and de-
select the check box ...

My question is this ... is there a way in C or C++ to write this into
the test.exe I made that simply shows "my name is .... "

This is where I am a total newb and have no idea where to go ... I
don't see any reference to a switch or execute in any of the library
files ... the stdio.h or stdlib.h ... i don't see where i can say

the directory is C:\windir
the program is C:\windir\default
the program has a properties tab
the properties tab has Misc, etc etc ...
the misc tab has an option for "close on exit"
the "close on exit" should be false

I have no idea really ... i don't even know if it possible ... maybe
it's better to just reg hack it and save the batch file ...

Any ideas ? or I am way the hell off base ? :) !
First, please don't top-post in this group, as you've done later in the
thread.

Your question really has nothing to do with C++. You'll get the same
effect no matter which language is used to create your executable. It's
purely a Windows issue.

Normally that would be off-topic, but this issue is so common that it
would be evil to send you somewhere else.

So: you can (1) use a command interpreter to run your program (there is
a primitive one shipped with Windows), (2) make a simple batch file to
run your program and pause, (3) use an Integrated Development
Environment that does the batch file thing for you automatically, (4)
make your program itself pause at the end, e.g. by reading a line from
standard input, or (5) use some other operating system than Windows.

The best option is (1), because you'll need to learn to use the computer
that way anyway, and the worst option, because it requires learning a
whole new operating system, is (5).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jan 28 '07 #10

P: n/a
http://en.wikipedia.org/wiki/Top-posting

first I have heard of it ... my bad ...

Jan 28 '07 #11

P: n/a
st************@gmail.com wrote:
If you have any fav news groups or sites with info that could help a
new guy out lemme know.
http://www.parashift.com/c++-faq-lite/
http://www.dinkumware.com/refxcpp.html
http://www.trumphurst.com/cpplibs/cpplibs.phtml
Jan 28 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.