Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Where did CVI, CVL, & CVD go???


Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2001, 02:26 PM
n6jah
Guest
 
Posts: n/a
Question Where did CVI, CVL, & CVD go???


Where did the CVI, CVL, and CVD instructions from Qbasic go?
Why did they not make the transition to VB?
Does anybody have a quick solution? Or do I have to think for myself?

jim

Reply With Quote
  #2  
Old 11-13-2001, 04:44 AM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: Where did CVI, CVL, & CVD go???

I don't do QBasic, but arn't those conversion functions?

If so, then you can use
CInt to convert to an integer
CLng to convert to a long and
CDbl to convert to a double.

__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #3  
Old 11-13-2001, 05:54 PM
n6jah
Guest
 
Posts: n/a
Default Re: Where did CVI, CVL, & CVD go???

Yes... they are Qbasic conversion functions.
They are not the same as Cint, etc.
CVI, CVL, CVD, and CVS converts a string
containing binary numeric information to
numbers... Integer, Long, Double, and
Single respectivley.
For Example
Put the integer 2314 (&h090A) into a string...
x$=chr$(10) & chr$(9)

i = Cint(x$) produces an error because x$
does not contain valid information for the
Cint. It wants either an expression or
string containing numeric characters.
Example: i = Cint("2314")

In Qbasic,
i = CVI(x$) converts the binary number
to an integer. The closest VB has that
I can see is the ASC function... but it
only does one byte at a time.

So I can do this for integers:
i = ASC(mid$(x$,1,1) + (ASC(mid$(x$,2,1)) * 256)

This works for Integers, and using the same
idea it will work for Longs too.
But what do I do for Doubles and Singles?

Right now, I can get around the problem
by getting the data from the file in binary...
one get at a time, like this:
GET #1,index+1,snglWeight
GET #1,index+5,dblDistance
etc...
It would be nice to be able to get a whole
string of information with one "get" and
process the different segments as needed.

jim
Reply With Quote
  #4  
Old 11-13-2001, 06:04 PM
Thinker Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default Re: Where did CVI, CVL, & CVD go???

I could be wrong, but I believe if you use a UDT, it will put and get without
any other conversions needed.
__________________
Posting Guidelines
Reply With Quote
  #5  
Old 11-13-2001, 11:28 PM
n6jah
Guest
 
Posts: n/a
Default Re: Where did CVI, CVL, & CVD go???

I think your elegent solution has solved my immediate problem, Thinker. I think I owe you a thank you...
Thank you Thinker!
jim
Reply With Quote
  #6  
Old 11-14-2001, 09:56 AM
Thinker Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default Re: Where did CVI, CVL, & CVD go???

You are welcome. Glad it worked for you! [img]images/icons/smile.gif[/img]
__________________
Posting Guidelines
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->