
Odd Behavior re: dim as string and then input
Hi vb folks,
this really comes as a surprise to me - I don't have a clue as to what
is escaping me, although something must be.
Here's my problem:
first I do: dim s,t as string
then I open a file and read a line from it: input #1, t
and what I get in the string variable t is only the first word from
the first line of my text file, rather than the whole line!
Now, the ONLY change I make in my program is to change the
dim statement to two lines:
dim s as string
dim t as string
and now t contains the whole line!! puzzling ?
I have two questions:
1. why should variable t behave differently? shouldn't t contain a
whole line of data?
2. what is the easiest way to read from a line in a text file each
word individually (separated by spaces, not commas) ?
Thanks for any reply - John.