Dark Bit Factory & Gravity
PROGRAMMING => Purebasic => Topic started by: Hotshot on June 24, 2011
-
I am trying to get the tutorials done but I get the error saying
Incorrect number of Parameters! eh?
; Initialize the sprite and keyboard systems and a 640x480, 16-bit screen
If InitSprite() = 0 Or InitKeyboard() = 0 Or OpenScreen(640,480,16,"App Title") = 0
MessageRequester("Error!", "Unable to Initialize Environment", #PB_MessageRequester_Ok)
End
EndIf
; include our generic library
XIncludeFile "../libraries/generic.pb"
; create the file
Result = CreateFile(#PB_Any,"filetest.txt")
If Result = 0
MessageRequester("Error!", "Unable to Create File", #PB_MessageRequester_Ok)
End
EndIf
; write our strings out to the file
WriteStringN("Hello, PureBasic!") ; << Why Errors?
WriteStringN("Testing...testing...1...2...3!") ; << Why Errors?
; close the file
CloseFile(Result)
; 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 ()
; end the program
End
-
Mate the helpfile is your friend. Use it. ;)
Syntax:
WriteStringN(#File, Text$ [, Flags])
so:
WriteStringN(Result,"Hello, PureBasic!")
should do the trick.
-
thanks :)
-
when you have told me the solution to the problem which
Createfiles.pb exerciser and got that working
then
I sorted out two other problem which is
ReadFile.pb
and
OpenFile.pb
that Job done and I going sorted out next chapters of it :)