Hi Charles
on Tue, 16 May 2006 03:55:10 +0200, you charleshixsn@earthlink.net wrote:
OK. Now: | fil lin n | fil := FileStream fileNamed: 'aising/data/technologies.csv' . n := 0. [fil atEnd] whileFalse: [ lin := fil nextLine. n := n + 1. Transcript cr; show: 'lin '; show: n; show: ' = '; show: lin. ]. Transcript cr; show: 'normal end after '; show: n; show: ' lines'.
You forgot to tell us a) SmalltalkImage current platformName b) fil lineEndConvention "after fil was opened" c) fil detectLineEndConvention "before the first nextLine"
Note that detectLineEndConvention scans only the first (LookAheadCount = 2048) characters.
/Klaus
results in: normal end lin 1 = 'technology' 'id' 'name' 'cost1' 'cost2' 'cost3' 'pre1' 'pre2' 'pre3' 'danger' 'typeName' 'typeValue' 1 'Autonomous Vehicles' 40000 1000 0 27 16 0 0 0 2 'Sociology' 10 500 0 0 0 0 0 'discover_public' 1000 3 'Voice Synthesis' 8000 6000 0 32 0 0 0 0 4 'Simulacra' 70000 90000 0 3 24 30 0 0 5 ... 'endgame_sing' 0 39 'Hypnosis Field' 7000 5000 0 21 0 0 0 0 40 'Quantum Computing' 30000 20000 0 11 0 0 0 0 41 'unknown' 1000000000 10000000000 0 41 0 0 0 0
normal end after 1 lines Notice that the linefeeds aren't being taken as line separators. They are present, and affecting the formatting of the output, but nextLine is grabbing the entire file.