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

I have this snippet to get the number of processor cores.
Problem is that the SHELL command produces a unicode text file and LINE INPUT is not able to read the text correctly.
Manually converting tmp.txt to an ascii file solves the problem.
Question is why is the file created as unicode by default?
Can I influence this from within QB64?
OS is Win 11.
Btw.: I tried also OPEN ... FOR BINARY - doesn't change anything (e.g. LINE INPUT still can't read UNICODE as text):

Code: (Select All)
    returncode% = SHELL("wmic cpu get NumberOfCores >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"
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Has anybody experience with MODBUS to read temp sensors? Rudy M 28 1,673 02-27-2026, 04:21 PM
Last Post: Rudy M
  code locks up when SHELL paulel 4 290 02-15-2026, 08:04 PM
Last Post: madscijr
Question Converting input from other devices to standard PC gamepad analog input? madscijr 0 176 01-01-2026, 06:39 PM
Last Post: madscijr
  Using Input$(1) Dimster 4 521 09-21-2025, 10:12 PM
Last Post: SMcNeill
  Input with _UPrintstring Dimster 6 806 07-16-2025, 02:38 PM
Last Post: Dimster

Forum Jump:


Users browsing this thread: 1 Guest(s)