Re: How do I convert this to Euphoria?

new topic     » goto parent     » topic index » view thread      » older message » newer message
bugmagnet said...

'http://vb.mvps.org/samples/project.asp?id=console 
Private Declare Function GetStdOutHandle Lib "kernel32" _ 
        Alias "GetStdHandle" _ 
       (Optional ByVal HandleType As Long = -11) As Long 
 
Private Declare Function WriteFile Lib "kernel32" _ 
       (ByVal hFile As Long, _ 
        ByVal lpBuffer As String, _ 
        ByVal cToWrite As Long, _ 
        ByRef cWritten As Long, _ 
        Optional ByVal lpOverlapped As Long) As Long 

I think I've figured out GetStdHandle, but WriteFile is still proving difficult. What's the declaration for this?

I could tell you, but I think you'll prefer opening STDOUT as a file like so:

integer stdout = open("CONOUT$", "w" ) 

...and then using normal printf / puts with that file number.

PS: I think WriteFile would be wrapped like so:

WriteFile = define_c_func( KERNEL32, "WriteFileA", {  
    C_POINTER,    -- HANDLE 
    C_POINTER,    -- Pointer to allocated String 
    C_INT,        -- size of the buffer 
    C_POINTER,    -- pointer to an int that will tell you how many bytes were written 
    C_POINTER },  -- pointer to an OVERLAPPED structure 
    C_INT ) 

The last two parameters are optional, and you're probably fine just to pass a zero for both of them.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu