?
Solved

Visual C++ problem. Easy!

Posted on 2003-02-22
12
Medium Priority
?
762 Views
Last Modified: 2012-06-27
Visual C++ problem!!!

I have a problem with a Borland C++ Dos converter i've made. Here's the part you need of the code:

void CBorlandCConverterDlg::OnStart()
{
     
     WinExec("bcc32 " + m_Target, SW_SHOW);
     
}
          After this DOS command I want a pause, so the command window will be there until the person pushes a button.

So the program works fine, but When this command is finished the command window closes itself.

Thanks!
0
Comment
Question by:TMM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 

Expert Comment

by:Fallen_Knight
ID: 7998646
well if you want a delay untill user action:

use iostream and just go

char ch;

cout << "Press any key to continue"
cin >> ch;

or even just a cin.get(); might work just fine.

so
void CBorlandCConverterDlg::OnStart() {
    WinExec("bcc32 " + m_Target, SW_SHOW);
    cin.get();
}
0
 

Author Comment

by:TMM
ID: 7999119
This is a Windows program, not a DOS...
0
 
LVL 3

Expert Comment

by:EarthQuaker
ID: 7999234
system("pause");
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
nietod earned 80 total points
ID: 7999437
rather than running the bcc32 program directly, run a command interpreter (command.com or cmd32.exe depending on the OS) and have the command interpreter run bcc32.
0
 
LVL 22

Expert Comment

by:nietod
ID: 7999450
For example

  WinExec("command.com /Kbcc32 " + m_Target, SW_SHOW);

this runs command.com with the /K command-line option, which runs a command and then after the command finishes, command.com continues to operate--wait for user input.

>> system("pause");
that douesn't work.  TMM needs to pause in an exusting  DOS box after it has completed a task.
0
 
LVL 22

Expert Comment

by:nietod
ID: 7999488
I should mention that you can get the path to and name of the command interpretter using the COMSPEC environmental variable
0
 

Author Comment

by:TMM
ID: 8078485
Thanks nietod, but it dosen't work.
Do you have another method???
0
 
LVL 22

Expert Comment

by:nietod
ID: 8079158
I what way doesn't it work?  (doesn't run, doesn't run right, doesn't pause ....)    Don't abandon the approach at the first setback.  It will work.
0
 

Author Comment

by:TMM
ID: 8097465
The command window says "invaild reference!"
Do you know whats wrong then?
Thanks
0
 
LVL 22

Expert Comment

by:nietod
ID: 8102619
post your code.   I need to see what you are doing
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9784174
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to nietod

Please leave any comments here within the next seven days. Experts: Silence
means you don't care.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question