Author Topic: Incorrect number of Parameters?  (Read 1419 times)

0 Members and 1 Guest are viewing this topic.

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Incorrect number of Parameters?
« on: June 24, 2011 »
I am trying to get the tutorials done but I get the error saying
Incorrect number of Parameters! eh?

Code: [Select]
; 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

Offline padman

  • Senior Member
  • Pentium
  • ********
  • Posts: 977
  • Karma: 258
    • View Profile
Re: Incorrect number of Parameters?
« Reply #1 on: June 24, 2011 »
Mate the helpfile is your friend. Use it. ;)

Syntax:

WriteStringN(#File, Text$ [, Flags])

so:

Code: [Select]
WriteStringN(Result,"Hello, PureBasic!")
should do the trick.


 
« Last Edit: June 24, 2011 by padman »
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Incorrect number of Parameters?
« Reply #2 on: June 25, 2011 »
thanks   :)

« Last Edit: June 25, 2011 by Hotshot »

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Incorrect number of Parameters?
« Reply #3 on: June 25, 2011 »
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 :)
« Last Edit: June 25, 2011 by Hotshot »