Help with OPEN/WRITE/CLOSE statement

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Help with OPEN/WRITE/CLOSE statement

Post by Sinuvoid »

I keep getting an error that says "type mismatch" but everythings perfect...someone wanna look at my code and figure it out?

Code: Select all

CLS
' menu
PRINT "(2) ADD"
PRINT "(1) SEARCH"
'my INKEY statment
kp$ = INKEY$
IF kp$ = "2" THEN GOTO Addp
IF kp$ = "1" THEN GOTO searchp
'This is the end of the menu

'This adds people to the database
addp:
CLS

INPUT "Age:", age$
INPUT "Name:", name$
INPUT "Personality:", per$
INPUT "Pasttimes:", past$
INPUT "Comment:", com$

OPEN database.txt FOR OUTPUT AS #1
WRITE #1, age$, name$
WRITE #1, per$
WRITE #1, past$
WRITE #1, com$
CLOSE #1


searchp:

[code/]

by the way its not done =)
Lachie Dazdarian
Veteran
Posts: 202
Joined: Mon Aug 30, 2004 6:18 am
Location: Croatia
Contact:

Post by Lachie Dazdarian »

Just make this change:

OPEN "database.txt" FOR OUTPUT AS #1
Lachie Dazdarian - The Maker Of Stuff
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

lmao, i guess ive solved and redid this problem like 5 times cause i remember someone sayin that =)
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

Lachie Dazdarian wrote:Just make this change:

OPEN "database.txt" FOR OUTPUT AS #1
:lol:
That happened to me. Just add quote marks.
For any grievances posted above, I blame whoever is in charge . . .
Post Reply