1. Can someone help
- Posted by Tom Harris <tom.harris at blueyonder.co.uk> Nov 23, 2001
- 478 views
This is a multi-part message in MIME format. ------=_NextPart_000_0048_01C17454.AAA501A0 charset="iso-8859-1" I want to save the of the name of the player at the end of the quiz in a file called highscore.txt but when I try to I can't. Please help! Thanks! Tom Harris. P.S: I have attached the file P.P.S: The answers to the questions go b, d, c, d. ------=_NextPart_000_0048_01C17454.AAA501A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4134.600" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>I want to save the of the name of the player at the end of the quiz in a file called highscore.txt but when I try to I can't. Please help!</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Thanks!</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Tom Harris.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>P.S: I have attached the file</FONT></DIV> <DIV><FONT face=Arial size=2>P.P.S: The answers to the questions go b, d, c,
2. Re: Can someone help
- Posted by pampeano at ROCKETMAIL.COM Nov 23, 2001
- 452 views
No file attached =( Best Regards, Guillermo Bonvehí AKA: KNiXEUR --- Tom Harris <tom.harris at blueyonder.co.uk> wrote: > > I want to save the of the name of the player at the end of the quiz > in a file called highscore.txt but when I try to I can't. Please > help! > > Thanks! > > Tom Harris. > > P.S: I have attached the file > P.P.S: The answers to the questions go b, d, c, d. > > > >
3. Re: Can someone help
- Posted by Tom Harris <tom.harris at blueyonder.co.uk> Nov 24, 2001
- 422 views
This is a multi-part message in MIME format. ------=_NextPart_000_0017_01C174C2.235A9160 charset="iso-8859-1" woops! here it is. ----- Original Message ----- From: <pampeano at ROCKETMAIL.COM> To: "EUforum" <EUforum at topica.com> Subject: Re: Can someone help No file attached =( Best Regards, Guillermo Bonvehí AKA: KNiXEUR --- Tom Harris <tom.harris at blueyonder.co.uk> wrote: > > I want to save the of the name of the player at the end of the quiz > in a file called highscore.txt but when I try to I can't. Please > help! > > Thanks! > > Tom Harris. > > P.S: I have attached the file > P.P.S: The answers to the questions go b, d, c, d. > > ------=_NextPart_000_0017_01C174C2.235A9160 Content-Type: application/octet-stream; name="tomsquiz.ex" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tomsquiz.ex" --TOM'S QUIZ is made by Tom Harris of HOCUS POCUS --HOCUS POCUS gAmEs include get.e include graphics.e include file.e include machine.e integer i integer q sequence name sequence highscore bk_color(WHITE) text_color(BLUE) allow_break(1) --The questions begin clear_screen() puts(1, "What is the name of the current royal family?\n") puts(1, "a. Tudor b.Windsor c.Stuart d.Elizabeth\n") i =3D wait_key() if i !=3D 'b' and i !=3D 'B' then if i =3D 'q' then clear_screen() puts(1, "Thankyou for playing!/n") abort(0) end if puts(1, "Sorry, that's the wrong answer!\n") abort(0) end if =20 clear_screen() -- here we go again! puts(1, "In what year did England win the world cup?\n") puts(1, "a. 1996 b.1986 c.1976 d.1966\n") i =3D wait_key() if i !=3D 'd' and i !=3D 'D' then if i =3D 'q' then clear_screen() puts(1, "Thankyou for playing!/n") abort(0) end if puts(1, "Sorry, that's the wrong answer!\n") abort(0) end if clear_screen() puts(1, "When did Steve Redgrave win his first gold medal?\n") puts(1, "a. 2000 b. 1992 c. 1984 d. 1996\n") i =3D wait_key() if i !=3D 'c' and i !=3D 'C' then if i =3D 'q' then clear_screen() puts(1, "Thankyou for playing!/n") abort(0) end if puts(1, "Sorry, that's the wrong answer!\n") abort(0) end if =20 clear_screen() puts(1, "How many times has cyclist Miguel Indurain won the 'Tour de = France'\n") puts(1, "a. 2 b. 3 c. 4 d. 5\n") i =3D wait_key() if i !=3D 'D' and i !=3D 'd' then if i =3D 'q' then clear_screen() puts(1, "Thankyou for playing!/n") abort(0) end if puts(1, "Sorry, that's the wrong answer!\n") abort(0) end if =20 clear_screen() =20 integer file_num constant ERROR =3D 2 file_num =3D open("highscore.txt", "u") if file_num =3D -1 then puts(ERROR, "couldn't open highscore\n") end if highscore =3D highscore.txt name =3D prompt_string("Please enter your name :") printf(highscore, "%s", {name}) abort(0) ------=_NextPart_000_0017_01C174C2.235A9160--
4. Re: Can someone help
- Posted by pampeano at ROCKETMAIL.COM Nov 24, 2001
- 420 views
Hi Tom, There's a thing I've to correct two things in your sources and a question I have to make to you. First, when you use printf, first parameter should be file_num because it's the file handler you got when you opened the file. Second, taken from open() reference in the manual "Files opened for read or update must already exist." You should open it for append, with the "a" attribute. The question is why are you asigning highscore = highscore.txt, maybe you wanted to do highscore = "highscore.txt" but anyway, it's a wasted variable, it doesn't do anything on your code. Best Regards, Guillermo Bonvehí AKA: KNiXEUR PS: After deleting the variable highscore, updating the printf's first parameter and using "a" in open() it worked right. Except a thing, if you use the dos interpreter, it only handles DOS's file format (8 characters and 3 for the extention). There's a library that handles longer files names in DOS 7 but I don't remember the name. --- Tom Harris <tom.harris at blueyonder.co.uk> wrote: > > woops! here it is. > ----- Original Message ----- > From: <pampeano at ROCKETMAIL.COM> > To: "EUforum" <EUforum at topica.com> > Sent: Saturday, November 24, 2001 1:56 AM > Subject: Re: Can someone help > > > No file attached =( > > Best Regards, > Guillermo Bonvehí > AKA: KNiXEUR > > --- Tom Harris <tom.harris at blueyonder.co.uk> wrote: > > > > I want to save the of the name of the player at the end of the quiz > > in a file called highscore.txt but when I try to I can't. Please > > help! > > > > Thanks! > > > > Tom Harris. > > > > P.S: I have attached the file > > P.P.S: The answers to the questions go b, d, c, d. > > > > > > > > ATTACHMENT part 2 application/octet-stream name=tomsquiz.ex ===== Best Regards, Guillermo Bonvehi AKA: Knixeur - Caballero Rojo
5. Re: Can someone help
- Posted by Tom Harris <tom.harris at blueyonder.co.uk> Nov 24, 2001
- 428 views
Thanks, it's working now. ----- Original Message ----- From: <pampeano at ROCKETMAIL.COM> To: "EUforum" <EUforum at topica.com> Subject: Re: Can someone help Hi Tom, There's a thing I've to correct two things in your sources and a question I have to make to you. First, when you use printf, first parameter should be file_num because it's the file handler you got when you opened the file. Second, taken from open() reference in the manual "Files opened for read or update must already exist." You should open it for append, with the "a" attribute. The question is why are you asigning highscore = highscore.txt, maybe you wanted to do highscore = "highscore.txt" but anyway, it's a wasted variable, it doesn't do anything on your code. Best Regards, Guillermo Bonvehí AKA: KNiXEUR PS: After deleting the variable highscore, updating the printf's first parameter and using "a" in open() it worked right. Except a thing, if you use the dos interpreter, it only handles DOS's file format (8 characters and 3 for the extention). There's a library that handles longer files names in DOS 7 but I don't remember the name. --- Tom Harris <tom.harris at blueyonder.co.uk> wrote: > > woops! here it is. > ----- Original Message ----- > From: <pampeano at ROCKETMAIL.COM> > To: "EUforum" <EUforum at topica.com> > Sent: Saturday, November 24, 2001 1:56 AM > Subject: Re: Can someone help > > > No file attached =( > > Best Regards, > Guillermo Bonvehí > AKA: KNiXEUR > > --- Tom Harris <tom.harris at blueyonder.co.uk> wrote: > > > > I want to save the of the name of the player at the end of the quiz > > in a file called highscore.txt but when I try to I can't. Please > > help! > > > > Thanks! > > > > Tom Harris. > > > > P.S: I have attached the file > > P.P.S: The answers to the questions go b, d, c, d. > > > > > ATTACHMENT part 2 application/octet-stream name=tomsquiz.ex ===== Best Regards, Guillermo Bonvehi AKA: Knixeur - Caballero Rojo