Qbasicnews.com

Full Version: freeBASIC reading CSV files (INPUT)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Sample code:
Code:
open "test.csv" for input as #1

do while not eof(1)
  input #1, a$
  print a$
loop

Sample file:
Code:
1,a,111
2,b,222
3,c,333
4,d,444
5,e,555
6,f,666
7,g,777
8,h,888
9,i,999

QBASIC and VB both treat INPUT as reading a field at a time.

EDIT: (to clarify)
QBASIC output is:
Code:
1
a
111
2
b
222
freeBASIC output is:
Code:
1,a,111
2,b,222

FreeBASIC is reading the entire line which is equivalent to:
Code:
line input #1, a$

Will this be changed, or do I need to port over a PARSE routine to break out the fields?
True, fixed.

Also the console input for strings, that was separating them if a white-space was found..