'These are functions that need help to translate for BCX 'IDC Feb/March 2008 #include 'sprintf has been deprecated since tchar and newer & "SAFER" functions are available. 'and snprint etc, need the max buffer size. IDC SUB uni_sprintf (Buffer$, Format$, ...) 'Arg as double) DIM RAW ap AS va_list va_start(ap, Format$) _vsntprintf(Buffer$, 1024 ,Format$, ap) va_end(ap) End SUB 'this is used in the Input$ function of bcx Function uni_gets$ OPTIONAL(r$, slen = 1024, stream AS FILE = 0) Dim RAW q$ * slen !//$EMIT_ANSI Dim RAW p$ * slen !//$EMIT_ANSI If stream = 0 then q$ = fgets(r$, slen , stdin) r$ = q$ End If Function = r$ End Function 'this is to replace GET function in ansi bcx Function uni_fRead OPTIONAL(stream AS FILE = 0, r$ = "", slen = 1024) !//$EMIT_ANSI Dim RAW p$ * slen ' fread(p$, sizeof(char), slen , stream) fread(p$, 1, slen , stream) !//$EMIT_ANSI r$ = ANSITOWIDE(p$) Function = len(r$) End Function 'this is to replace PUT function in ansi bcx SUB uni_fwrite (stream AS FILE, r$, slen) !//$EMIT_ANSI Dim RAW p$ * slen p$ = WideToAnsi$(r$) ! fwrite(p,1, slen,stream); !//$EMIT_ANSI End SUB ' WriteFile emits only 1/2 no of characters, either len * 2 or use WidetoAnsi function on the string to write see con demo #42 Function uni_WriteFileW (hConsole as handle ,A$,intA as integer,ret as LPDWORD ,iNULL as LPOVERLAPPED ) !//$EMIT_ANSI Dim nRet nRet = WriteFile(hConsole, WideToAnsi$(A$),intA,ret,iNULL) Function = nRet !//$EMIT_ANSI End Function Function uni_GetProcAddress(hInst AS HANDLE, buff AS STRING) AS HANDLE !//$EMIT_ANSI Function = GetProcAddress(hInst,WideToAnsi$(buff) ) !//$EMIT_ANSI End Function 'Function Uni_InputBox$(Title$, Prompt$, Value$) ''char *InputBox (char *Title, char *Prompt, char *Value) '!//$EMIT_ANSI ' Function = AnsiToWide$(InputBox ( WideToAnsi$(Title), WideToAnsi$(Prompt), WideToAnsi$(Value))) '!//$EMIT_ANSI 'End Function 'Emulate MultiByteToWideChar when its alredy WideChar Function Uni_MultiByteToWideChar(CodePage as UINT, Flags as DWORD, mSDtr$, nBytes as integer, mWSDtr$, nWBytes as integer) as integer mWSDtr$ = mSDtr$ Function = LEN(mWSDtr$) End Function Function uni_ttof(tmpstr$) as Double !char *stopstring; Function = strtod(tmpstr$, &stopstring$) End Function 'NOTES: 'This is for PellesC only, MS2007 seems to have a wide version of SearchTreeForFile 'Function SearchTreeForFileW(Drive2Scan$, File2Find$, Result$) ' Dim nRet '!//$EMIT_ANSI ' Dim RAW tmpResult$ '!//$EMIT_ANSI ' nRet = SearchTreeForFile(WidetoAnsi$(Drive2Scan$), WidetoAnsi$(File2Find$), tmpResult$) ' Result$ = AnsiToWide$(tmpResult$) ' Function = nRet 'End Function ' 'I add this line directly to my keywords file '"#define VAL(a)(double)atof(a)" , "#define VAL(a) (double)strtod(a,(char**)NULL)"