|
-
Jan 26th, 2002, 02:02 PM
#1
Thread Starter
Hyperactive Member
Cpp Question (translate code VB - VCPP)
Greetings,
would you please so kind and translate this piece of VB code to a VCPP version.
Many thanks in advance.
Public Sub gAddProgress()
Static stintCounter As Integer
Static stblnFlag As Boolean
If stblnFlag = False Then
stintCounter = 1
stblnFlag = True
Else
Call AddOne(stintCounter)
End If
End Sub
-
Jan 26th, 2002, 03:58 PM
#2
Fanatic Member
Info.
Try this... There is a remote chance it may work... 
Code:
//Definition
void gAddProgress();
//Implementation
void gAddProgress()
{
static int stintCounter;
static bool stblnFlag;
if (stblnFlag == false)
{
stintCounter = 1;
stblnFlag = true;
}
else
{
//Make sure your AddOne function is defined...
AddOne(stintCounter);
}
}
Hope this helps.
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Jan 27th, 2002, 10:47 AM
#3
Monday Morning Lunatic
Use a short rather than an int, because Integer in VB is only 2 bytes but an int in 32-bit C and C++ is 4 bytes.
Minor quibble I know, but best to be accurate
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 27th, 2002, 12:38 PM
#4
And the more common method of testing a bool is
if(bFlag)
// true
if(!bFlag)
// false
AddOne needs this prototype
void AddOne(short& s);
Which is the translation of Vb
Public Sub AddOne(ByRef s as Integer)
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 27th, 2002, 10:19 PM
#5
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|