Seite 2 von 2

Re: printf

Verfasst: 19.01.2015 15:55
von funkheld
Hallo, warum wird hier bitte auf der Console nichts angezeigt?

Gruss

Code: Alles auswählen

ImportC ""
  wprintf(format.s, a1=0, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0)
EndImport

OpenConsole()
myVariable.s = "value"
wprintf ("My Text: %s", @myVariable)
Input()

Re: printf

Verfasst: 19.01.2015 16:03
von RSBasic
Unicode und Console als Executable-Format müssen aktiviert sein.

Re: printf

Verfasst: 20.01.2015 12:52
von funkheld
Jup, danke.

Gruss

Re: printf

Verfasst: 20.01.2015 22:03
von _JON_
Du musst natürlich nicht unbedingt auf Unicode wechseln.
Bei reinen Konsolenanwendungen ist das nicht immer die beste Wahl.

Code: Alles auswählen

ImportC ""
  CompilerIf #PB_Compiler_Unicode
    printf(format.s, a1=0, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0) As "wprintf"
  CompilerElse
    CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
      printf(format.s, a1=0, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0) As "_printf"
    CompilerElse
      printf(format.s, a1=0, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0) As "printf"
    CompilerEndIf    
  CompilerEndIf
EndImport

OpenConsole()
myVariable.s = "value"
printf ("My Text: %s", @myVariable)
Input()

Re: printf

Verfasst: 20.01.2015 22:24
von ts-soft
Ich würde es aber eher umgekehrt machen! (nur dann funktioniert es auch, wie gedacht).

Code: Alles auswählen

ImportC ""
  CompilerIf #PB_Compiler_Unicode
    CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
      printf(format.s, a1=0, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0) As "_wprintf"
    CompilerElse
      printf(format.s, a1=0, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0) As "wprintf"
    CompilerEndIf
  CompilerElse
    printf(format.s, a1=0, a2=0, a3=0, a4=0, a5=0, a6=0, a7=0, a8=0)
  CompilerEndIf
EndImport

OpenConsole()
myVariable.s = "value"
printf ("My Text: %s", @myVariable)
Input() 
Sobald ich das As Keyword benutze, muß die Original-Schreibweise eingehalten werden, also führender Unterstrich bei x86.
Sobald ich das As Keyword nicht nutze, kann ich die Original-Schreibweise nutzen, ohne Unterstrich.

Gruß
Thomas

Re: printf

Verfasst: 20.01.2015 22:55
von _JON_
Oh, gut aufgepasst Thomas.
Dachte wirklich ich hätte alle 4 Möglichkeiten gestestet :oops: