Subject Re: Computer serial number
From Heinz Kesting <Nobody@Nowhere.com>
Date Sat, 20 Apr 2024 10:38:10 +0200
Newsgroups dbase.getting-started

Hi Rachhpal
> Thanks everybody.
> The following code works but when it displays the serial number every digit has space in between.
> ///////////
> run("wmic bios get serialnumber > c:\temp\serial_no.txt")
> f = new file()
> f.open("c:\temp\serial_no.txt")
> mserial_head = f.gets()                        // first line in text file is heading "Serial number"
> mserial_no = f.gets()
> f.close()
> clear
> ? mserial_head
> ? mserial_no

At the moment I can not spent time trying to get the string out of the
textfile without those unwanted spaces in the first place, but you can
easily remove them afterwards with the following small routine.

for i = 1 to len(mserial_no)
    if substr(mserial_no, i, 1) = [ ]           // a BLANK is found
       mserial_no = stuff(mserial_no, i, 1, []) // removes each BLANK
    endif
next i

? ":" + mserial_no + ":" // now all BLANKS should be removed

Hope this helps, kind regards, Heinz