Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

QBASIC .dat files help


ghost's Avatar
0 0

For school we need to make a program that you input a name and it makes a .DAT file of the name you imputed. I have no idea what the open statement for this would be can someone please help.

Thanks, Muplah


clone4's Avatar
Perl-6 Wisdom Seeker
0 0

muplah wrote: For school we need to make a program that you input a name and it makes a .DAT file of the name you imputed. I have no idea what the open statement for this would be can someone please help.

Thanks, Muplah

wow I didn't know somebody was still writing qbasic, that's like win 95 language:D anyway maybe this will throw you in right direction:

INPUT Name$

OPEN "MyFile.dat" FOR OUTPUT AS #1

PRINT #1, Name$

CLOSE #1


spyware's Avatar
Banned
0 0

http://www.colchsfc.ac.uk/computing/manuals/qbasic/QB09.htm

Also tell your teacher that a Dutch guy named "Spyware" told you that QBasic isn't the right way to get started with programming. Tell him you want to learn something useful, like Python. It's a great introduction language and you can actually apply it in real life. QBasic died many eons ago, and should be left alone.


ghost's Avatar
0 0

Thanks Clone, but that will input the name in myfile.dat, our teacher is making us have something where it makes the .dat file as the name so it makes like paul.dat. Its weird and I am not sure if it is possible. And yeah no one uses qbasic(besides my teacher).

Spyware it seems like your link also is similar to Clone's examples it writing to studant.dat not depending on what you input. Which is what I need. And spyware I do not know python, but I agree qbasic should not be taught.


ghost's Avatar
0 0

muplah wrote: Thanks Clone, but that will input the name in myfile.dat, our teacher is making us have something where it makes the .dat file as the name so it makes like paul.dat. Its weird and I am not sure if it is possible. And yeah no one uses qbasic(besides my teacher).

You will find quite often teachers are lazy and reuse projects. I can almost assure you its possible, and that he knows the answer to it.


spyware's Avatar
Banned
0 0

OPEN sname$+".dat" FOR INPUT AS #1

Something like this. You have to combine a variable (the name part) and a string (.dat).


clone4's Avatar
Perl-6 Wisdom Seeker
0 0

the code btw was just like from the first google link ;) I don't know qbasic, because well who does:) and I'm little too lazy to find out how you do that, but just put the input into a variable, and then find out how to create a new file. Usually it is just 'opening' new file for writing. It is fairly easy task, google should answer most of your queries from this point ;)

or look above:)


ghost's Avatar
0 0

Thanks both of you, I think your onto something though spy. But it is giving me the error bad file name


spyware's Avatar
Banned
0 0

muplah wrote: Thanks both of you, I think your onto something though spy. But it is giving me the error bad file name

I don't know the exact syntax of QBasic. In most languages though, it's variable+"string". Just ask your teacher to explain you the syntax.


ghost's Avatar
0 0

I got it working, thanks so much spyware! If you need anything dont hesitate to ask, I might most likely wont be able to help but umm its thought that counts :D


AldarHawk's Avatar
The Manager
0 0

Spyware actually helping? Who are you and what have you done with my pal spyware?


AldarHawk's Avatar
The Manager
0 0

let me take a line straight from you bloody profile

About User I own approximately 6.8% of shoutbox posts.

So please STFU about spamming. Please crawl back under your god damn rock and eat the turd that is coming out of your ass because you are so full of shit.

Learn what you are actually writing about before you do so you do not look like a total idiot like here.

So please learn to lay off and get your shit together so that you can ensure that i does not back fire on you. And I know you will come back with some small "belittling" remark that you think you will get away with. However, you do not know that no matter what you are typing on HBH, it means nothing in life. Learn…do not burn your bridges that you cannot see. They could hinder your escape from the real world in the future. So please….STFU spammer.


spyware's Avatar
Banned
0 0

**AldarHawk wrote:**Text

Aldarhawk, you can't flame for shit. Really, you shouldn't even attempt to flame. I'm sorry man, it's just not your thing :/

Also, it might have something to do with your current BAC level.


AldarHawk's Avatar
The Manager
0 0

spyware wrote: [quote]**AldarHawk wrote:**Text

Aldarhawk, you can't flame for shit. Really, you shouldn't even attempt to flame. I'm sorry man, it's just not your thing :/

Also, it might have something to do with your current BAC level.[/quote]

nope. just got tired of his shit…nothing more. But thank you for your normal brutal honesty once again…now you are back :D