[futurebasic] Re: [FB] INPUT #

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1999 : Group Archive : Group : All Groups

From: AlStaff@...
Date: Fri, 29 Jan 1999 22:47:57 EST
>I'm embarrassed to have to solicit your help, but I am having trouble 
>with INPUT# trying to read sets of variable length strings from a data 
>file. First item in the file is a count of the number of strings that 
>follow - it inputs fine - all confirmed by reading the same file with 
>HexEdit 1.0.7.  Then I set up a for next loop to read that many strings 
>into my string array (globally dimensioned: DIM 30 gHnames$ (200). For 
>the first INPUT# 1,gHnames$(I), I see (in the debugger) the first string, 
>fine.  For the second time through the loop, I see the third string - I'm 
>not getting the even numbered strings... Where could they be going, what 
>am I doing wrong here?
>
>The strings are in the file delimited with carriage returns and each 
>string is preceeded by a hex 22 (double quote).



1. Are you sure your strings aren't longer than 30 characters since that's all
you're DIMming them.

2. INPUT doesn't like strings without quotes around them.

3. INPUT does NOT like commas at the end of a line like this:
"string1",
"string2",
"string3",

4. INPUT does NOT like empty lines.
"string1"

"string2"
"string3"

5. INPUT does NOT like empty strings without quotes:
"string1", , "string3"

-----

Your data should look like any of the following:
1.
"string1"
"string2"
"string3"

2.
"string1", "string2", "string3"

3.
"string1"
""
"string3"

4.
"string1", "", "string3"

-----

If the data was made by other programs so you can't change the format, you
need to look at inputting the entire file (or large chunks) and then parsing
it.


Hope that helps.

Al Staffieri Jr.

AlStaff@...
http://members.aol.com/AlStaff/index.html