TextStream.ReadLine Mac Newline
am 09.01.2007 00:11:06 von mike.biang
I am using the textstream object to read a CSV file and parse through
the fields. I use the readline() method to read in each line of the
file, and parse the contents into the values of the different fields.
With files generated on a windows system, this works fine.
However, when working with CSV files genereated through Excel on a Mac,
the entire contents of the file is read when I make the first ReadLine
call. I imagine that this is because Mac uses a different newline
character than windows machines do (Carraige Return vc Carraige Return
+ Line Feed). I'm theorizing that ReadLine doesn't recognize just the
Carraige Return generated by a Mac.
Has anyone encountered an issue like this, or does anyone know of any
work arounds?
Thanks!
Mike Biang
mike -at- cramerdev dot com
Re: TextStream.ReadLine Mac Newline
am 09.01.2007 15:20:51 von mike.biang
I found my own solution. Doing a bit more in depth search solved the
problem.
http://groups.google.com/group/microsoft.public.scripting.vb script/browse_thread/thread/b136eb4190bebf14?hl=en&lr=lang_e n&ie=UTF-8&oe=UTF-8
mike.biang@gmail.com wrote:
> I am using the textstream object to read a CSV file and parse through
> the fields. I use the readline() method to read in each line of the
> file, and parse the contents into the values of the different fields.
>
> With files generated on a windows system, this works fine.
>
> However, when working with CSV files genereated through Excel on a Mac,
> the entire contents of the file is read when I make the first ReadLine
> call. I imagine that this is because Mac uses a different newline
> character than windows machines do (Carraige Return vc Carraige Return
> + Line Feed). I'm theorizing that ReadLine doesn't recognize just the
> Carraige Return generated by a Mac.
>
> Has anyone encountered an issue like this, or does anyone know of any
> work arounds?
>
> Thanks!
> Mike Biang
> mike -at- cramerdev dot com