Solved

some general questions from a vb guy!!!

Posted on 1998-11-25
2
161 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now