[430b5]Problems with ReadProgramString()

Just starting out? Need help? Post your questions and find answers here.
harff182
Enthusiast
Enthusiast
Posts: 105
Joined: Thu Dec 08, 2005 4:58 pm
Location: Duesseldorf, Germany

[430b5]Problems with ReadProgramString()

Post by harff182 »

moin, moin...

I have compiled this for console:

Code: Select all

If OpenConsole()
  title.s = ""
  Repeat
    title + ProgramParameter()
  Until ProgramParameter() = ""
  
  PrintN("data = start")
  PrintN("title = "+title)
  PrintN("otitle = The silence of the lambs")
  PrintN("year = 1990")
  PrintN("country = USA")
  PrintN("regie = Jonathan Demme")
  PrintN("mmactor = Anthony Hopkins")
  PrintN("mfactor = Jodie Foster")
  PrintN("fsk = 16")
  PrintN("len = 108")
  PrintN("type = feature movie")
  PrintN("genre = psycho-thriller")
  PrintN("data = end")
  Delay(5000)
  CloseConsole()
 EndIf
End
Now I call it this way:

Code: Select all

hProcess = RunProgram("plugin.exe","Das Schweigen der Lämmer","",#PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
  If hProcess
    Debug "No something should appear..."
   
    Repeat
      Debug ReadProgramString(hProcess)
    Until ProgramRunning(hProcess) = #False
    
    CloseProgram(hProcess)
  EndIf
 
End
I get debugged:
No something should appear...
d
t
o
y
c
r
m
m
f
l
t
g
d
What am I doing wrong?

TIA...
scholly
Sorry 4 my poor English, it's the only one I learned 40 years ago...
since 17.12.08: XPHome(SP3) + PB 4.30
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I bet the first program is compiled with unicode on, the other one with unicode off.
harff182
Enthusiast
Enthusiast
Posts: 105
Joined: Thu Dec 08, 2005 4:58 pm
Location: Duesseldorf, Germany

Post by harff182 »

Arrrrgl... :oops:

Image How did you know so fast?
It was the other way around.

Thx...
scholly
Sorry 4 my poor English, it's the only one I learned 40 years ago...
since 17.12.08: XPHome(SP3) + PB 4.30
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

When only the first character arrives it's a classical unicode problem. It's because of the unicode storage format with 0 bytes as part of low characters. In ascii mode, this 0 byte means the string should terminate there and then.
harff182
Enthusiast
Enthusiast
Posts: 105
Joined: Thu Dec 08, 2005 4:58 pm
Location: Duesseldorf, Germany

Post by harff182 »

Thanks.
I like to learn new things this way, as I shurly will not forget this "problem" of my code and the solution.
Sorry 4 my poor English, it's the only one I learned 40 years ago...
since 17.12.08: XPHome(SP3) + PB 4.30
Post Reply