Re: unicode and puts -- exwc
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Jun 06, 2007
- 491 views
FD(censored) wrote: > > > hrmm even exwc terminates so putting two bytes at a time will not work. > > My $64,000 question then is, how do I put the byte "0" to the screen... > > or it's back to UTF-8 How about this:
include dll.e constant msvcrt = open_dll("msvcrt.dll"), putch_ = define_c_proc( msvcrt, "_putch", {C_INT} ) global procedure binputs( sequence data ) for i = 1 to length(data) do c_proc( putch_, {data[i]}) end for end procedure binputs( "abc" & 0 & "def\n" )
You could, of course, wrap binputs as a dll, if it's not fast enough for you: // binio.c #include <conio.h> void __stdcall __export binputs( const char * s, int len ){ while( len--) putch( *s++); } int __stdcall LibMain(int hDLL, int Reason, void *Reserved) { return 1; } // end binio.c To build with watcom: wcl386 binio.c -bd -ecd -zz -l=NT_DLL Matt