Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SHELL creates unicode file, can't read correctly with LINE INPUT
#2
Welcome to the forums.

You might have to create a second temporary file, after the output of the first "SHELL". I'm not sure where "strings.exe" program is located but you could write a "SHELL" command like this:

Code: (Select All)
SHELL "strings.exe tmp.txt > tmp2.txt"
IF _FILEEXISTS("tmp2.txt") THEN
:
END IF
KILL "tmp2.txt"
KILL "tmp.txt"

This "strings.exe" program comes packaged with QB64, somewhere with "g++" compiler, preprocessor, library maker and other utilities. I use Linux regularly and therefore have forgotten a lot of things about Windows, and I have refused to upgrade from Windows10 21H2 on a different computer.

The path should be: "(qb64path)/internal/c/c_compiler/bin" or something like that. You could do a search in File Explorer for EXE files into "(qb64path)/internal/c". The "(qb64path)" is a placeholder for the place on your system what is called the "home" directory of QB64. This should be somewhere in your user account, not "Program Files" and even less "Program Files (x86)" if it exists, nor anywhere else on C: drive. It should be something that looks like "C:/Users/(yourname)/qb64" to begin with.

EDIT: set your PATH temporarily to "(qb64path)/internal/c/c_compiler/bin" before running your program which should be something like this:

Code: (Select All)
returncode% = SHELL("wmic cpu get NumberOfCores >tmp2.txt")
    returncode% = SHELL("strings.exe tmp2.txt >tmp.txt")
  
    IF _FILEEXISTS("tmp.txt") THEN
        OPEN "tmp.txt" FOR INPUT AS #1
            DO UNTIL EOF(1)
                LINE INPUT #1, a$
                ?">";a$;"<";filecount%;",len=";len(a$)
                filecount% = filecount% + 1
            LOOP
        CLOSE #1
    END IF

    'KILL "tmp.txt"
    'KILL "tmp2.txt"
Reply


Messages In This Thread
RE: SHELL creates unicode file, can't read correctly with LINE INPUT - by mnrvovrfc - 05-05-2023, 10:57 PM



Users browsing this thread: 2 Guest(s)