Liberty BASIC Community Forum
« Zeros problem. »

Welcome Guest. Please Login or Register.
Jun 25th, 2017, 05:29am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Zeros problem.  (Read 222 times)
LBcode
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 101
xx Zeros problem.
« Thread started on: Nov 30th, 2015, 6:55pm »

When I use this code I retrieve the value which is a double digit number, but if the number has a zero in it like 09 or 03 the number I get back is 9 or 3 . I checked the database and it is being added correctly as 03 or 09 etc. Does the code below first input the digits as numbers and then convert it to a string? And since if it is retrieving it as a number, the zero gets dropped? What do I need to do to get the 03 or 09 to be retrieved from the database as entered with the leading zero? If the number is 33 or 99 for example there is no problem. Just when there is a leading zero.
Any help would be appreciated.

PS The number should be a string and it is not used as a number in the program. It only needs to display on screen correctly.


Code:
'---------------------------------------------------------------
Open "database\ch00co01ro10.txt" for input as #ch00co01ro10
input #ch00co01ro10, ch00co01ro10
close #ch00co01ro10
ch00co01ro10$ = str$(ch00co01ro10)


'------------------------------------------------------------------------------
 
« Last Edit: Nov 30th, 2015, 8:55pm by LBcode » User IP Logged

GaRPMorE
Senior Member
ImageImageImageImage


member is offline

Avatar

"Not everything that counts can be counted, and not everything that can be counted counts." - Albert Einstein


PM


Posts: 288
xx Re: Zeros problem.
« Reply #1 on: Nov 30th, 2015, 9:52pm »

Input the number as a string to preserve th leadng zero.
Code:
input #ch00co01ro10, ch00co01ro10$ 
User IP Logged

from the world according to GaRPMorE
LBcode
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 101
xx Re: Zeros problem.
« Reply #2 on: Nov 30th, 2015, 10:37pm »

Thank you very much GaRPMorE for answering. That did it. smiley
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls