Before You Post, Please Note...

-> Please Note: By Posting, you agree to submit the contents of your post to the Public Domain <- SEE: howto post to this blog

Friday, February 2, 2007

puppybasic intro ch. 17 - other useful statements

green text is being edited and should not be considered  
relevant to the tutorial.
for a while, it will make up
the bulk of this section.

black text has been edited to be more accurate with
regards to puppybasic.

........................................................................
other useful statements
1 of 7




an intro to puppybasic

chapter 17: other useful statements







........................................................................

........................................................................
other useful statements
2 of 7

SHELL calls a dos command. dos of course, is not only capable of
managing operations with files and folders, it can call other pieces
of software. running large programs from shell may result in an "out
of memory" error from dos. (usually not an issue.)

here's a nice example for SHELL:
SHELL "dir *.* /a /b > dirfile.txt"

this creates a file called "dirfile.txt" containing a list of all
files in the current folder. then you can load the list with the OPEN
command.


........................................................................

........................................................................
other useful statements
3 of 7

mode co40 is another useful dos command, but doesn't always (if ever)
work in windows xp. (for some reason, every time windows makes a new
dos emulator it does even less of the stuff that dos or the previous
dos emulator did.)

it is better still to use mode con cols=40, which works in xp and can
be used in puppybasic like this:

SHELL "mode con cols=40"




........................................................................

........................................................................
other useful statements
4 of 7

this is better than width 40, as it's more likely to work. i knew of
one project that wouldn't stay in WIDTH 40 unless you first shelled to
run this dos command, then used WIDTH 40 as well.










........................................................................

........................................................................
other useful statements
5 of 7

COMMAND$

quickbasic (compiler) only. reads the arguments typed next to
a standalone exe's name, from dos or windows, so if your compiled
program was called appli01.exe and you were to type:

c:\winnt\>appli01 New.txt /fs
at the dos prompt (for instance) and you put this at the beginning of
your program:

q$=COMMAND$ 'then the string q$ would contain: "New.txt /fs"


........................................................................

........................................................................
other useful statements
6 of 7

SYSTEM

use this instead of END, this is only useful when using the
interpreter. it ends the program, but if the
interpreter is running, exits the interpreter also.
this only works if you've run a program using /run
[file].bas or /run file... etc. (from a script for instance.)

an example:




........................................................................

........................................................................
other useful statements
7 of 7

SYSTEM
END 'you don't need END here, but it hurts nothing and is easy to spot
'when other people are reading your code.


-= end of chapter 17 =-







........................................................................
an intro to puppybasic (chapter 17)
this content is public domain.
........................................................................

click here to go back to the contents page

0 comments: