[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2006-12-08T20:36:20-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/1964 2006-12-08T20:36:20-05:00 2006-12-08T20:36:20-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13434#p13434 <![CDATA[Command Line Argument/Switch]]>
BTW, unprintable just means that you can't actually see the character when you print it to the screen or printer, but it's there and gets sent to the device.

Regards..... Moneo

Statistics: Posted by moneo — Fri Dec 08, 2006 8:36 pm


]]>
2006-12-08T16:17:49-05:00 2006-12-08T16:17:49-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13426#p13426 <![CDATA[Command Line Argument/Switch]]>
.....More on my program...
So how can I add non printable Characters in a Print statement? Specifically an ASCii Value of 001
You can add any valid ASCII characters you want, either directly to a PRINT command or to a string, like:
PRINT "BLABLABLA"+CHR$(001) ... or more
or
A$="BLABLABLA"+CHR$(001)
PRINT A$

I'm guessing that you-re going to print to file or a comm line or a special printer, otherwise printing to the screen won't show the special characters.

Regards..... Moneo
I was not aware I could Print non-printable characters... makes perfect sense... :roll:

Either way, I will admit, I did ask the question before actually trying. I just assumed you can't print non-printable characters.

CHR$(001) is the character the Synchronet BBS uses to determine what color will be displayed in the BBS Software.... For example, to display Red text, it is STRINGTOPRINT$ = CHR$(001) + "R" + STRINGTOPRINT$

I did get it going... and it is a good thing, but it has become cumbersome keeping track of CHR$(001) plus color codes... so now I am going to define the colors as a pre-defined string and just sdd it instead of the other stuff... For example:

REDTXT$ = CHR$(001) + "R"
BLUETXT$ = CHR$(001) +"B"

STRINGTOPRINT = REDTXT$ +STRINGTOPRINT$

Statistics: Posted by Mike Alexander — Fri Dec 08, 2006 4:17 pm


]]>
2006-12-07T19:55:43-05:00 2006-12-07T19:55:43-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13422#p13422 <![CDATA[Command Line Argument/Switch]]>
.....More on my program...
So how can I add non printable Characters in a Print statement? Specifically an ASCii Value of 001
You can add any valid ASCII characters you want, either directly to a PRINT command or to a string, like:
PRINT "BLABLABLA"+CHR$(001) ... or more
or
A$="BLABLABLA"+CHR$(001)
PRINT A$

I'm guessing that you-re going to print to file or a comm line or a special printer, otherwise printing to the screen won't show the special characters.

Regards..... Moneo

Statistics: Posted by moneo — Thu Dec 07, 2006 7:55 pm


]]>
2006-12-06T22:25:42-05:00 2006-12-06T22:25:42-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13418#p13418 <![CDATA[Command Line Argument/Switch]]>
Checkout the COMMAND$ function.

Using the same command-line that you posted, your program can get the names of the 2 files as follows:

Code:

c$ = command$     'get the command-line, except for the .EXE name.s = instr(c$," ")     'find location of space delimiter between filenames.if s = 0 then print "Invalid or missing filenames" : systemfilold$ = left$(c$,s-1)     'Get leftmost filename.filold$ = ltrim$(rtrim$(filold$))     'Get rid of any leading or trailing spaces.filnew$ = mid$(c$,s+1)     'Get leftmost filename.filnew$ = ltrim$(rtrim$(filnew$))
Now you have the filenames so you can open them.
The only problem now is that the name of the input "old" file might be invalid, and you'll get an error when you open it. But, that's another subject.

Regards..... Moneo
More on my program...

So how can I add non printable Characters in a Print statement? Specifically an ASCii Value of 001

Statistics: Posted by Mike Alexander — Wed Dec 06, 2006 10:25 pm


]]>
2006-12-03T17:46:12-05:00 2006-12-03T17:46:12-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13378#p13378 <![CDATA[Command Line Argument/Switch]]>
..
Can I have an error trap for my whole program? By that I mean at the very top (just before my mainline) I can put an "on error goto errortrap" and then .all for errors that dont have an error code in my trap.
Here's the recommended way to handle error trapping, by Mac, over at Qbasic.com.

As you can see, he generally has ON ERROR GOTO 0 to trap all the unknown errors that might occur. When he suspects the possibility of an error on a particular instruction, he first does an ON ERROR GOTO GetMyError, does the suspect instruction, and then turns error trapping off again. I've tested this method and it works very well.

See his sample program below. Notice instructions flagged with REM NOTE...

Code:

DECLARE SUB aMain ()DECLARE FUNCTION StatusFile% (f AS STRING)DIM SHARED MyErr AS INTEGERCALL aMainSYSTEMGetMyErr: MyErr = ERR: RESUME NEXT    REM NOTE....SUB aMainCLS : LOCATE 2, 20: PRINT "Testing function StatusFile": PRINTPRINT "Enter file names to be tested. Just press Enter when finished."DO  PRINT  LINE INPUT "fname: "; f$  IF f$ = "" THEN EXIT DO  SELECT CASE StatusFile(f$)  CASE 0: PRINT "Bad File Name"  CASE 1: PRINT "Exists"  CASE 2: PRINT "Does not exist"  END SELECTLOOPSYSTEMEND SUBFUNCTION StatusFile% (f AS STRING)IF LEN(f) = 0 THEN EXIT FUNCTION' Ensure no spaces anywhereIF INSTR(t$, " ") > 0 THEN EXIT FUNCTION' Separate file name from path, if anyDIM y AS INTEGERFOR y = LEN(f) TO 1 STEP -1  SELECT CASE MID$(f, y, 1)  CASE "", "/", ":": EXIT FOR  CASE " ": EXIT FUNCTION  END SELECTNEXT yIF y = 1 THEN t$ = f ELSE t$ = RIGHT$(f, LEN(f) - y)' Test for prefix(8 max).suffix(3 max)FOR y = LEN(t$) TO 1 STEP -1  IF MID$(t$, y, 1) = "." THEN    IF LEN(t$) - y > 3 THEN EXIT FUNCTION' suffix>3    IF y = 1 THEN EXIT FUNCTION ' name was just "."    t$ = LEFT$(t$, y - 1): EXIT FOR  END IFNEXT yIF LEN(t$) > 8 THEN EXIT FUNCTION' OK, now test whole thing for reaMaining errorsMyErr = 0: ON ERROR GOTO GetMyErr   REM NOTE....OPEN f FOR INPUT AS #1: CLOSEON ERROR GOTO 0                          REM NOTE...IF MyErr = 0 THEN StatusFile% = 1   REM NOTE....IF MyErr = 53 THEN StatusFile% = 2  REM NOTE....END FUNCTION

Statistics: Posted by moneo — Sun Dec 03, 2006 5:46 pm


]]>
2006-12-02T23:55:42-05:00 2006-12-02T23:55:42-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13368#p13368 <![CDATA[Command Line Argument/Switch]]>
Right, if the user makes a typo error on the filename, you'll get a "file not found" error on the open. Using the ON ERROR is a good way to catch this.

Regards..... Moneo
Can I have an error trap for my whole program? By that I mean at the very top (just before my mainline) I can put an "on error goto errortrap" and then build a case switch for each error number???? of course I would need the catch all for errors that dont have an error code in my trap....

Statistics: Posted by Mike Alexander — Sat Dec 02, 2006 11:55 pm


]]>
2006-12-02T16:05:47-05:00 2006-12-02T16:05:47-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13363#p13363 <![CDATA[Command Line Argument/Switch]]>
Regards..... Moneo

Statistics: Posted by moneo — Sat Dec 02, 2006 4:05 pm


]]>
2006-12-01T22:44:19-05:00 2006-12-01T22:44:19-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13348#p13348 <![CDATA[Command Line Argument/Switch]]>
Now you have the filenames so you can open them.
The only problem now is that the name of the input "old" file might be invalid, and you'll get an error when you open it. But, that's another subject.

Regards..... Moneo
Ok... So that worked exactly like you said... so now what were you meaning about an error.... Why would the old file be invalid? You mean that if the file does not exist I will get the error?
-----------edited-----------
What I have done is put On Error Goto MyErrorThing before the Open command. Then create this>>>
MyErrorThing:
Print FILENAME$ +"Does not exist"
END

Statistics: Posted by Mike Alexander — Fri Dec 01, 2006 10:44 pm


]]>
2006-12-01T22:20:36-05:00 2006-12-01T22:20:36-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13347#p13347 <![CDATA[Command Line Argument/Switch]]>
:-)

Statistics: Posted by Mike Alexander — Fri Dec 01, 2006 10:20 pm


]]>
2006-12-01T21:30:05-05:00 2006-12-01T21:30:05-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13345#p13345 <![CDATA[Command Line Argument/Switch]]>
Using the same command-line that you posted, your program can get the names of the 2 files as follows:

Code:

c$ = command$     'get the command-line, except for the .EXE name.s = instr(c$," ")     'find location of space delimiter between filenames.if s = 0 then print "Invalid or missing filenames" : systemfilold$ = left$(c$,s-1)     'Get leftmost filename.filold$ = ltrim$(rtrim$(filold$))     'Get rid of any leading or trailing spaces.filnew$ = mid$(c$,s+1)     'Get leftmost filename.filnew$ = ltrim$(rtrim$(filnew$))
Now you have the filenames so you can open them.
The only problem now is that the name of the input "old" file might be invalid, and you'll get an error when you open it. But, that's another subject.

Regards..... Moneo

Statistics: Posted by moneo — Fri Dec 01, 2006 9:30 pm


]]>
2006-12-01T20:33:31-05:00 2006-12-01T20:33:31-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=13344#p13344 <![CDATA[Command Line Argument/Switch]]>
I was thinking the call to my program would be something like this:

NEWPRG.EXE OLDFILE.NAM NEWFILE.NAM

Any hints or examples of how to set this up?

Thanks all!

Mike Alexander

Statistics: Posted by Mike Alexander — Fri Dec 01, 2006 8:33 pm


]]>