944,070 Members | Top Members by Rank

Ad:
Jun 8th, 2007
0

BASIC Languages File I/O Help

Expand 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!
Last edited by gamingfan1993; Jun 8th, 2007 at 8:46 pm. Reason: Rewrite
Similar Threads
Reputation Points: 9
Solved Threads: 1
Newbie Poster
gamingfan1993 is offline Offline
6 posts
since Jun 2007
Jun 9th, 2007
-1

Re: BASIC Languages File I/O Help

bump
Reputation Points: 9
Solved Threads: 1
Newbie Poster
gamingfan1993 is offline Offline
6 posts
since Jun 2007
Jun 9th, 2007
0

Re: BASIC Languages File I/O Help

#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....
Moderator
Reputation Points: 3281
Solved Threads: 894
Posting Sage
WaltP is offline Offline
7,747 posts
since May 2006
Jun 14th, 2007
0

Re: BASIC Languages File I/O Help

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.
Reputation Points: 23
Solved Threads: 2
Junior Poster in Training
indienick is offline Offline
71 posts
since Aug 2005
Jul 4th, 2007
0

Re: BASIC Languages File I/O Help

I also agree with that advice look for vb or more advance language
Reputation Points: 10
Solved Threads: 0
Newbie Poster
albash is offline Offline
3 posts
since Jun 2005
Sep 4th, 2007
0

Re: BASIC Languages File I/O Help

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bregalad is offline Offline
3 posts
since Sep 2007
Oct 17th, 2007
0

Re: BASIC Languages File I/O Help

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
Reputation Points: 7
Solved Threads: 2
Junior Poster
HLA91 is offline Offline
177 posts
since Oct 2006
Oct 23rd, 2007
0

Re: BASIC Languages File I/O Help

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
Reputation Points: 53
Solved Threads: 13
Junior Poster
hopalongcassidy is offline Offline
148 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: ftp inside function in korn shell script
Next Thread in Legacy and Other Languages Forum Timeline: 2d to 3d mapping....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC