** 1 page regular / 630 words ** ** Mike: If this fits neatly in two columns we can use the third ** column for the GEMTrade Ad - let me know. Basic BASIC! How long is a piece of string? Paul Jones is your guide... This time we're going to look at string manipulation. Any program which gets data from text files has to expect the unexpected and be prepared for users to push your program to the outer limits of its programming (Ed: Not to mention magazine reviewers!). To understand strings and how to edit them, we're going to concentrate on three commands: LEFT$(), RIGHT$() and MID$(). LEFT$() is a function and takes two parameters. The syntax is LEFT$(string$, num). The function takes the string and takes the first ** I've put these on separate lines for clarity ** ** they should form part of the running text ** ** ITALIC ON ** num ** ITALIC OFF ** characters and returns that. RIGHT$() takes the same parameters, but works from the right hand end of the text string. MID$() is slightly different, it's still a function, but it takes three parameters. The syntax is MID$(string,num,length). Taking the string, it starts at the character number ** ITALIC ON ** num ** ITALIC OFF ** and copies ** ITALIC ON ** length ** ITALIC OFF ** characters, and returns the result. Here's an example: ** np ** a$="Read Atari Computing" b$=LEFT$(a$,4) c$=RIGHT$(a$,9) d$=MID$(a$,6,5) PRINT b$ PRINT c$ PRINT d$ ** /np ** LEFT$() takes the first four characters and stores the result in b$. RIGHT$() takes the last nine characters and puts them into c$. Finally MID$() starts at the sixth character and puts the next five characters in d$. The output displayed should be: ** np ** Read Atari Computing ** /np ** Evasive action Last issue we illustrated how hackers could spot your passwords in the machine code using a disk editor. One way to avoid this is to string manipulation to avoid including the password in the program directly. For example, another field such as the username, can be used to generate the final password, so taking "Fred Bloggs" the code to generate the password could be: ** np ** a$="Fred Bloggs" ' our starting name pass$=LEFT$(a$,2)+RIGHT$(a$,3)+MID$(a$,2,2) ** /np ** Which would generate a password of "Frggsed" for "Fred Bloggs". Because we haven't specified any strings, hackers won't find the password in the program, and figuring out the formula used to generate the password should be enough to deter most hackers. ** Column width Reader Disk banner here ** On the reader disk you'll find the latest version of PDO with the new RSC file. I've updated the register dialog to incorporate the name field "regname". The formula for calculating the password is: ** np ** LEFT$(name$,2)+RIGHT$(name$,3)+MID$(name$,3,3) ** /np ** You can check the field is working by entering "Paul Jones" into the name field (making sure there are no preceding or trailing spaces) then entering "Panesul ". Click on register and it should report you've entered the correct key. Note space characters are counted as part of the password. Now you can work out the password for your own name from the formula and register yourself! Next issue we'll take a look at command lines and how menus work. ** boxout 1 ** Virtual Invisibility Since the start of the Virtual BASIC, the project has been renamed to Virtual Language, to accommodate this the system is now being designed to be modular, supporting all languages. Paul Jones is working with Mark Wherry to offer supporting modules for HiSoft BASIC and C. ** /boxout ** ** boxout 2 ** All things HiSoft BASIC related... Following the closure of Paul Jones mailing list we're pleased to report Matthew Bacon has started up a mailing board which HBASIC users can access to exchange ideas. Check out his homepage at: ** BC ** http://www.kingston.ac.uk/~k964101/ ** /BC ** Paul and Matthew will be exhibiting at ACC '98 in November so why not come along and exchange ideas face to face? ** /boxout **