Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - alexpro1ny

Pages: [1]
1
QB64 Discussion / Re: Can QB64 finish without the screen disappearing
« on: February 24, 2018, 02:54:29 pm »
Your program probably has a call to SYSTEM. Replacing that with END will keep your screen up with "Press any key to continue" or similar. That won't allow you to scroll back in case your output is longer than the screen, though.

You can, however, create a console application and replicate the DOS experience by having your program output to terminal:

Code: QB64: [Select]

Add the snippet above to the beginning of your program.

Thank you!  This works great!  Much appreciated!

2
QB64 Discussion / Can QB64 finish without the screen disappearing
« on: February 23, 2018, 08:02:19 pm »
Hi,

In PDS 7.1, you could have your program run, print some lines of text and when done, close and the text would still be visible on your dos screen.  I have a program where it looks for a specific type of error in a text file.  If the error is there, it prints the offending line on the screen and to a log file.  When done, the numbers of errors are printed and the program ends.  I can still see the output while I'm at the dos or cmd prompt.

When I run this program now in QB64, the screen is gone when the program ends.  I have to look at the log file that the program creates in order to see the errors.  Is there any way to not clear the screen other than by putting a pause before it exits?   The program doesn't do any screen formatting.  I'm new to QB64 and just figuring out the differences.

Thanks

3
QB64 Discussion / Re: DIR$ function from Microsoft Professional Basic
« on: February 23, 2018, 07:29:40 pm »
DIM dskfile$(200)
filespec$ = "*.txt"
' Caution. If you already have a file named tmp.txt, this next statement will overwrite a file named tmp.txt in your current directory.
SHELL _HIDE "dir /b " + filespec$ + ">tmp.txt"
' The /b switch returns only the file names.
OPEN "tmp.txt" FOR INPUT AS #1
DO UNTIL EOF(1)
    LINE INPUT #1, a$
    dskfile = dskfile + 1
    dskfile$(dskfile) = a$
LOOP

FOR i = 1 TO dskfile
    PRINT i; dskfile$(i)
NEXT
-----------------------------------

Also, check out _FILEESIST in the WIKI: https://qb64.org/wiki

Pete :)

Thanks Pete... I used to do it like this before the DIR$ function was added.  It worked but I try to avoid using SHELL as much as possible.  Thanks though.

4
QB64 Discussion / Re: DIR$ function from Microsoft Professional Basic
« on: February 23, 2018, 07:27:39 pm »
There's a DIR$() function written by Ted at http://qb64.org/wiki/FILES - a fine workaround.

Thanks.. that looks like the ticket I've been looking for.

5
QB64 Discussion / DIR$ function from Microsoft Professional Basic
« on: February 23, 2018, 03:23:51 pm »
Hi,

I used to write my code using Professional Basic (QBX) 7.1

It was a nice program since you could test and debug your code within the compiler without having to make a .exe file first.

I have been using QB64 to convert some of my programs so they would work in Windows 10 and love that it is available.  Without QB64, I'd have to run everything in my Virtual XP window.

I installed your latest version 1.2 and found that it doesn't like the DIR$ command that is a valid function within QBX.   It looks like _DIR$ is in QB64 but it doesn't work the same as DIR$.

For example, if I want to see a list of text files, I can do the following in QBX

DIM dskfile$(200)

filespec$ = "*.txt"
a$ = _DIR$(filespec$)

IF LEN(a$) = 0 THEN GOTO nofilesexist

dskfile = 1
dskfile$(dskfile) = a$

DO
    b$ = DIR$
    IF LEN(b$) = 0 THEN GOTO filelistdone
    dskfile = dskfile + 1
    dskfile$(dskfile) = b$
LOOP

GOTO filelistdone

nofilesexist:

STOP

filelistdone:
FOR n = 1 TO dskfile
    PRINT dskfile$(n)
NEXT n

PRINT dskfile; "files exist"

Using this method I can store into my array all the files that are named .txt

Is there any simple way for me to do the same in QB64?

Thanks,
Alex

Pages: [1]