0 Members and 1 Guest are viewing this topic.
; Initialize the sprite and keyboard systems and a 640x480, 16-bit screenIf InitSprite() = 0 Or InitKeyboard() = 0 Or OpenScreen(640,480,16,"App Title") = 0 MessageRequester("Error!", "Unable to Initialize Environment", #PB_MessageRequester_Ok) EndEndIf; include our generic libraryXIncludeFile "../libraries/generic.pb"; create the fileResult = CreateFile(#PB_Any,"filetest.txt")If Result = 0 MessageRequester("Error!", "Unable to Create File", #PB_MessageRequester_Ok) EndEndIf ; write our strings out to the fileWriteStringN("Hello, PureBasic!") ; << Why Errors?WriteStringN("Testing...testing...1...2...3!") ; << Why Errors?; close the fileCloseFile(Result); put up a little message to the user that we're doneIf StartDrawing(ScreenOutput()) DrawText(0,0,"File created and written to. Press any key to exit")Else MessageRequester("Error!", "Unable to Draw to ScreenOutput()", #PB_MessageRequester_Ok) EndEndIfStopDrawing(); show the output to the usersFlipBuffers(); wait for a keypressWaitKey (); end the programEnd
WriteStringN(Result,"Hello, PureBasic!")