' uses the system DLL msvcrt to create and write text to a binary file. ' also shows how to create a zero terminated 8 bit character string ' 2010-06-23 newscript dim myDLLf = dll.open ("msvcrt") IF ( myDLLf = 0 ) THEN Message ="Could not open the DLL file" stop end IF ' wide character version of fopen dim wcfOpen = dll.link(myDLLf , "_wfopen" ,2 , "UNSIGNED" ) IF ( ! wcfOpen ) THEN Message = "Could not find: _wfopen" stop end IF ' ASCII version of fopen dim afOpen = dll.link(myDLLf , "fopen" ,2 , "UNSIGNED" ) IF ( ! afOpen ) THEN Message = "Could not find: _wfopen" stop end IF dim fWrite = dll.link(myDLLf , "fwrite" ,4 , "UNSIGNED" ) IF ( ! Fwrite) THEN Message = "Could not find: Fwrite" stop end IF dim fClose = dll.link(myDLLf , "fclose" ,1 , "UNSIGNED" ) IF ( ! fClose ) THEN Message = "Could not find: fclose" stop end IF dim vbCRLF = chr ( 0x0d ) & chr ( 0x0a) function cZstr ( wStr as string ) cZstr = TextToByteArray ( wStr, 0 ) End Function dim cString ' the widecharacter version dim fileHandle = wcfOpen ( @ tmpTxtfile , "wb" ) ' the ASCII version ' dim fileHandle = afOpen ( @ cZstr (tmpTxtfile) , @ cZstr ("wb") ) cString = "Hello World" & vbCRLF fWrite ( @ cZstr (cString) , 1 , length( cString ) , fileHandle) cString = "Have a nice day today!" & vbCRLF fWrite ( @ cZstr (cString) , 1 , length( cString ) , fileHandle) fclose ( fileHandle ) message = "The result is in the text file at: " & tmpTxtfile