BASIC Languages File I/O Help

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 6
Reputation: gamingfan1993 is an unknown quantity at this point 
Solved Threads: 1
gamingfan1993 gamingfan1993 is offline Offline
Newbie Poster

BASIC Languages File I/O Help

 
0
  #1
Jun 8th, 2007
Ok I mainly use Liberty BASIC, which is very, very similar to Visual BASIC, and I am having a hard time with a program. I made my program take a user's input, and save it in a text file, like so:

Username=Name,Phone#,Email
John Doe=John Doe,000-0000,email@email.com

But that isn't my problem. The problem is, is that I want the program to allow someone to type in "John Doe" and display it like so:

Username: John Doe
------------------------
Name: John Doe
Phone #: 000-0000
Email Address: email@email.com

Please explain in detail, in any BASIC language(s) that you may know, it doesn't matter, they are all similar!
Last edited by gamingfan1993; Jun 8th, 2007 at 8:46 pm. Reason: Rewrite
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 6
Reputation: gamingfan1993 is an unknown quantity at this point 
Solved Threads: 1
gamingfan1993 gamingfan1993 is offline Offline
Newbie Poster

Re: BASIC Languages File I/O Help

 
-1
  #2
Jun 9th, 2007
bump
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,121
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 283
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: BASIC Languages File I/O Help

 
0
  #3
Jun 9th, 2007
#1: Never bump your messages!!!! People will respond when they see it, and 5 hours is not a long time.

#2: If all Basics are so similar, there is no detail needed. And since you already know they are similar, why are you asking? And where do you get your info that they are similar? They aren't that close in my experience....
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 71
Reputation: indienick is an unknown quantity at this point 
Solved Threads: 2
indienick's Avatar
indienick indienick is offline Offline
Junior Poster in Training

Re: BASIC Languages File I/O Help

 
0
  #4
Jun 14th, 2007
The rudeness of some people on this forum floors me.

gamingfan1993, here's a rough sketch (in QBASIC):

INPUT "User to look up: ", lookup$

OPEN "data.txt" FOR READ AS #1

lengthoflookup% = LENGTH(lookup$)

WHILE NOT EOF(1)
  LINE INPUT #1, buffer$
  IF LEFT$(buffer$, lengthoflookup%) = lookup$ THEN
    username$ = LEFT$(buffer$, lengthoflookup%)
    realname$ = MID$(buffer$, lengthoflookup% + 2, lengthoflookup%)
    phonenumber$ = MID$(buffer$, lengthoflookup% * 2 + 4, 8)
    email$ = MID$(buffer$, (lengthoflookup% * 2) + 14, (lengthoflookup% * 2 + 14) - lengthoflookup%)
    BREAK
WEND

PRINT "Username: "; username$
PRINT STRING$(20, "-")
PRINT "Name: "; realname$
PRINT "Phone Number: "; phonenumber$
PRINT "Email: "; email$

CLOSE #1

My suggestion, get away from BASIC languages - they get you into a lot of bad habits.
Angel-headed hipsters burning for the ancient heavenly connection, to the starry dynamo in the machinery of the night.
-Ginsburg

Don't tell me to "google it" - I already have.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 3
Reputation: albash is an unknown quantity at this point 
Solved Threads: 0
albash albash is offline Offline
Newbie Poster

Re: BASIC Languages File I/O Help

 
0
  #5
Jul 4th, 2007
I also agree with that advice look for vb or more advance language
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 3
Reputation: bregalad is an unknown quantity at this point 
Solved Threads: 0
bregalad bregalad is offline Offline
Newbie Poster

Re: BASIC Languages File I/O Help

 
0
  #6
Sep 4th, 2007
Nice one, I was going to drop in a few of my favorite VisualBasic/QuickBasic library functions and show how to use the first line as a format specifier for the rest of the file, but liberty basic I remember has a weird sub style of whose memory I've tried to forget the horror...

Speaking of horror is there a way to take the address of a QuickBasic Function or Sub, once I have my pointer to function loaded with the address I know how to call it, but...

I don't mind coding in assembly, if I had some idea what I was trying to do?

I've thought about making the sub call an asm proc walking the stack to find the calling sub then rewinding the code to find the a stackframe push. but I don't have any idea exactly how I would write something like that...
Last edited by bregalad; Sep 4th, 2007 at 3:56 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 179
Reputation: HLA91 is an unknown quantity at this point 
Solved Threads: 2
HLA91 HLA91 is offline Offline
Junior Poster

Re: BASIC Languages File I/O Help

 
0
  #7
Oct 17th, 2007
If you use liberty basic then use liberty basic forum http://libertybasic.conforums.com/ Im not saying dont come to daniweb but the people at LB forum might be able to help you more in relation to liberty
You know your a geek, if you introduce your wife as "mylady@home.wife"
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 147
Reputation: hopalongcassidy is an unknown quantity at this point 
Solved Threads: 13
hopalongcassidy's Avatar
hopalongcassidy hopalongcassidy is offline Offline
Junior Poster

Re: BASIC Languages File I/O Help

 
0
  #8
Oct 23rd, 2007
Originally Posted by gamingfan1993 View Post
Ok I mainly use Liberty BASIC, which is very, very similar to Visual BASIC, and I am having a hard time with a program. I made my program take a user's input, and save it in a text file, like so:

Username=Name,Phone#,Email
John Doe=John Doe,000-0000,email@email.com

But that isn't my problem. The problem is, is that I want the program to allow someone to type in "John Doe" and display it like so:

Username: John Doe
------------------------
Name: John Doe
Phone #: 000-0000
Email Address: email@email.com

Please explain in detail, in any BASIC language(s) that you may know, it doesn't matter, they are all similar!
Try this:

Sub main()
    Dim name As String
    Dim phone As String
    Dim email As String
    
    name = InputBox("Enter name: ")
    phone = InputBox("Enter phone: ")
    email = InputBox("Enter e-mail: ")
    
    Call MsgBox("Name = " & name & ", phone = " & phone & ", E-mail = " & email)
    
End Sub

Hoppy
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum


Views: 2702 | Replies: 7
Thread Tools Search this Thread



Tag cloud for Legacy and Other Languages
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC