Hello Charles again thx First for Help with both msgbox asm examples
Next for the road tried to Convert an old freebasic example Code only Line 38 is Here a Problem readConsoleA() function or it's more?
Thx in advance, Frank
' frebasic
'#include "crt.bi"
'#include "windows.bi"
' oxygen basic
'
uses corewin
uses console
' Declare external functions
declare function GetStdHandle( byval nStdHandle as ulong ) as long
declare function ReadConsoleA( byval hConsoleInput as long, byval lpBuffer as integer, byval nNumberOfCharsToRead as long, byref lpNumberOfCharsRead as long, byval lpReserved as integer ptr ) as long
' Define constants
% STD_INPUT_HANDLE = -10
% STD_OUTPUT_HANDLE = -11
% STD_ERROR_HANDLE = -12
% BUFSIZE = 128
' Define input function
function InputBox( prompt as string ) as string
dim as long bytes_read
dim as any ptr input_handle
dim as integer ptr buffer ' integer 'any
dim as string input_text
' Get handle to console input
input_handle = GetStdHandle( STD_INPUT_HANDLE )
' Allocate memory for input buffer
'buffer = allocate( BUFSIZE )
buffer = sysallocStringLen( BUFSIZE )
' Print prompt
print prompt
' Read input from console
' problem zone ---------------------------------------------- //
ReadConsoleA( input_handle, buffer, BUFSIZE, bytes_read, 0 )
' problem zone ---------------------------------------------- //
' Convert buffer to string
input_text = Str(buffer) '*buffer
' Free memory
free( buffer )
' Return input text
return input_text
end function
' Main program
dim as string names
' Get user input
names = InputBox( "Enter your name: " )
' Print input
print "Hello, " + names + "!"
wait
'sleep
inc\console.inc provides the low-level stuff. You can deconstruct or override it if necessary:
uses console
print "Enter your name: "
string name=ltrim(rtrim(input()))
if name
print cr
print "Hello, " + name + "!" + cr
wait
endif