Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Input from file
#1
in this code
Code:
CLS
OPEN "C:\en.txt" FOR INPUT AS #1
INPUT #1, a$
CLOSE #1
PRINT a$

if en.txt contains
Code:
Hello, Bob
It will only have "Hello" how can i get past this?
Reply
#2
In the text doc. (en.txt) if you remove the comma then it prints
Code:
Hello bob
Reply
#3
Yeah but i dont want to disallow the comma when i use this in my program.
Reply
#4
What are you trying to do??? IF your trying to get it to say Hello, bob then put commas around the whole thing...
Reply
#5
Use LINE INPUT #1, a$ ... It comes in the almighty QB help Wink

Code:
LINE INPUT # - a file I/O statement that reads an entire line without
               delimiters from a sequential file to a string variable
Syntax
  LINE INPUT #filenumber,stringvariable
    â–  filenumber is the number of an open sequential file
    â–  stringvariable will hold all characters from the sequential file
      from the current position in the file up to, but not including, the
      next carriage-return-line-feed sequence. No carriage-return-line-feed
      sequences are ever input.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#6
Quote:Use LINE INPUT #1, a$ ... It comes in the almighty QB help

Thanks na_th_an that was just what i needed(+a little tweak)
Code:
OPEN fi$ FOR INPUT AS #1
fi$ = ""
DO
LINE INPUT #1, doot$
fi$ = fi$ + doot$ + CHR$(13)
LOOP UNTIL EOF(1)
CLOSE #1

Ok, my project shall be unveiled in a little while.
Reply
#7
Quote:... Ok, my project shall be unveiled in a little while.

We'll all be waiting with bated breath! :wink:
*****
Reply
#8
is it some super cool Win32 compiler for QB?
Reply
#9
Maybe an e-greeting card Tongue
url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79][Image: safer.gif][/url]
END OF LINE.
Reply
#10
:roll: :roll:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)