I am not able to insert a image here. So i give the example code that i use
Code: Select all
; Initialize the sprite and keyboard systems and a 640x480, 32-bit screen
If InitSprite() = 0 Or InitKeyboard() = 0 Or OpenScreen(640,480,32,"App Title") = 0
MessageRequester("Error!", "Unable to Initialize Environment", #PB_MessageRequester_Ok)
End
EndIf
Declare Waitkey() ;<----- Here is the decleration
; include our generic library
XIncludeFile "../libraries/generic.pb" ;<---- here is the include
; create the file
FilePtr = CreateFile(#PB_Any,"filetest.txt")
If FilePtr = 0
MessageRequester("Error!", "Unable to Create File", #PB_MessageRequester_Ok)
End
EndIf
; write our strings out to the file
WriteStringN(FilePtr,"Hello, PureBasic!") ;<--- Compiler point to this line and say that waitkey() is an error
WriteStringN(FilePtr,"Testing...testing...1...2...3....4!")
; close the file
CloseFile(FilePtr)
; put up a little message to the user that we're done
If 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)
End
EndIf
StopDrawing()
; show the output to the users
FlipBuffers()
; wait for a keypress
WaitKey() ;<-- here is the line
; end the program
End
What is wrong here.
Bart Fernhout.