Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64 bug when using Inform
#15
(07-22-2023, 01:24 AM)SMcNeill Wrote:
(07-21-2023, 11:13 PM)a740g Wrote:
(03-29-2023, 11:56 PM)bplus Wrote: Text Fetch still works after all these years in QB64pe.exe v 3.6
Here is the updated version of Text Fetch that works with QB64-PE 3.8 and InForm-PE. It also has an updated and simplified version of SMcNeill 's direntry.h
Simplified version of direntry?  Can you share it with me sometime, with a few comments about which/what you altered/expanded/simplified?

I've included it on the zip I shared above.

Here's a link to it from my GitHub.
InForm-PE/examples/TextFetch/direntry.h at master · a740g/InForm-PE (github.com)

Code: (Select All)

' --- DIRENTRY STUFF ---

DECLARE LIBRARY "direntry"
    ' This opens a directly for reading it's contents
    ' IMPORTANT: Call the open_dir() wrapper instead of calling this directly. open_dir() properly null-terminates the directory string
    FUNCTION __open_dir%% (dirName AS STRING)

    ' This reads a single directory entry. You can call this repeatedly
    ' It will return an empty string once all entries have been read
    ' "flags" and "fileSize" are output parameters (i.e. use a variable)
    ' If "flag" is 1 then it is a directory and 2 if it is a file
    FUNCTION read_dir$ (flags AS LONG, fileSize AS LONG)

    ' Close the directory. This must be called before open_dir() or read_dir$() can be used again
    SUB close_dir
END DECLARE

' This properly null-terminates the directory name before passing it to __load_dir()
FUNCTION open_dir%% (dirName AS STRING)
    open_dir = __open_dir(dirName + CHR$(0))
END FUNCTION

' --- DIRENTRY STUFF ---

The biggest change here is that read_dir$() is now a FUNCTION and returns a string. Other than this, open_dir() returns a QB compatible bool if it fails. There is some protection for possible memory leaks if open_dir() is used without calling close_dir().
Reply


Messages In This Thread
QB64 bug when using Inform - by TDarcos - 03-24-2023, 06:18 PM
RE: QB64 bug when using Inform - by bplus - 03-24-2023, 07:13 PM
RE: QB64 bug when using Inform - by aurel - 03-25-2023, 07:10 AM
RE: QB64 bug when using Inform - by TDarcos - 03-25-2023, 11:01 AM
RE: QB64 bug when using Inform - by RhoSigma - 03-25-2023, 11:31 AM
RE: QB64 bug when using Inform - by TDarcos - 03-26-2023, 03:17 PM
RE: QB64 bug when using Inform - by bplus - 03-26-2023, 04:06 PM
RE: QB64 bug when using Inform - by RhoSigma - 03-26-2023, 04:57 PM
RE: QB64 bug when using Inform - by bplus - 03-26-2023, 06:11 PM
RE: QB64 bug when using Inform - by RhoSigma - 03-26-2023, 08:01 PM
RE: QB64 bug when using Inform - by bplus - 03-29-2023, 11:56 PM
RE: QB64 bug when using Inform - by a740g - 07-21-2023, 11:13 PM
RE: QB64 bug when using Inform - by SMcNeill - 07-22-2023, 01:24 AM
RE: QB64 bug when using Inform - by a740g - 07-22-2023, 07:09 AM
RE: QB64 bug when using Inform - by bplus - 07-21-2023, 11:36 PM
RE: QB64 bug when using Inform - by bplus - 07-22-2023, 11:38 AM
RE: QB64 bug when using Inform - by GareBear - 07-22-2023, 03:47 PM
RE: QB64 bug when using Inform - by mnrvovrfc - 07-22-2023, 05:15 PM



Users browsing this thread: 4 Guest(s)