Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SHELL creates unicode file, can't read correctly with LINE INPUT
#3
Try piping the output through MORE, which will output plain old text:


[Image: 2023-05-05-202953.png]


Code: (Select All)
'JSR sez: changed returncode to _UNSIGNED _INTEGER64, added line to print it & dump it to a file.
'When compiled with QB64PE 32-bit, returncode~&& is different every time I run this program (typically 106AC990000ACBC, but the first 4 hex digits are different each time).
'When compiled with QB64PE 64-bit, returncode~&& is ACBC.  Still a mystery.
'Haven't had much luck decoding that return code on Google just yet.

returncode~&& = Shell("wmic cpu get NumberOfCores | more >tmp.txt")

Print Hex$(returncode~&&)
o$ = "echo " + Hex$(returncode~&&) + ">TestForTheSolarCode_returncode.txt"
Shell (o$)


If _FileExists("tmp.txt") Then
    Open "tmp.txt" For Input As #1
    Do Until EOF(1)
        Line Input #1, a$
        Print ">"; a$; "<"; filecount%; ",len="; Len(a$)
        filecount% = filecount% + 1
    Loop
    Close #1
Else
    Print "tmp.txt not found"
End If

'KILL "tmp.txt"

FWIW: I had to run the WMIC command on the command line to test it.  Trying it with the QB64PE (32-bit, hmm) Shell function on my Win7 Pro 64-bit system returns a code and fails to create tmp.txt.
(Update: OK, I just tested this program on QB64PE-64, and it is failing with a code of ACBC now.  No idea what _that_ means.) (This is my final edit... I pinkie-swear.)

FWIW2: https://research.nccgroup.com/2022/03/10...owershell/
Reply


Messages In This Thread
RE: SHELL creates unicode file, can't read correctly with LINE INPUT - by JRace - 05-06-2023, 01:48 AM



Users browsing this thread: 3 Guest(s)