Solved

some general questions from a vb guy!!!

Posted on 1998-11-25
2
190 Views
Last Modified: 2010-04-01
Two questions.

1. Visual Basic has a feature called On Error Resume Next and On Error GoTo TrapError, which allows you to trap error and/or avoid them. Is there a similar way of doing this is C++? Everytime I run into an error, I have to reboot my computer.

2. VB also has a feature which allows you to exit a function from within a function. It's something like "Exit Sub". How do I do this in C++. Do I use Break?

Thanks.
0
Comment
Question by:hobster
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 0 total points
ID: 1178643
1. For something like 'On Error goto' use C++ TRY/CATCH statements

2. No, 'break' can only be used in loops and 'sitch' statements, simply use 'return( <returntype>)
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1178644
1. try, catch, and throw for errors.
2. equivalent of EXIT SUB is the return statement.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

679 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