Weekly Qbasic and Qb64 Lesson Topics
April 19, 2024, 04:40:58 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

Name, Input File saveing

Pages: [1]
  Print  
Author Topic: Name, Input File saveing  (Read 3903 times)
ChatKing
Post Demos
*
Posts: 23


« on: November 27, 2011, 11:52:42 am »

Hi to all

What I understood from your idea is that a program ask for the name if doesn't exist and then display, but if the name exists then it only display. I mean obviously it will ask for the name input at first run but then on every subsequent run it will only display the name. If I am write the code for this are as following, please check and then tell me were you asking about this, the code are as following:-

Code:
DIM na AS STRING
DIM a AS INTEGER

CLS
OPEN "Names.txt" FOR BINARY AS #1
a = LOF(1)
CLOSE #1

IF (a = 0) THEN
    INPUT "Enter Your Name : "; na
    OPEN "Names.txt" FOR OUTPUT AS #1
    PRINT #1, na
    CLOSE #1
    PRINT "Hello "; na
ELSE
    OPEN "Names.txt" FOR INPUT AS #1
    INPUT #1, na
    CLOSE #1
    PRINT "Hello "; na
END IF


Do you mean this the above code will ask for name only on first run until the text file names.txt exist in the directory on every subsequent run it will only display the code. Please comment, I am waiting and if this is not your desired code then a bit elaborate your question if you can by showing examples. Thanks

Keen to know about your idea.

Report Spam   Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy