From: Jonathan Wood on
Hi Stanza,

> What is the easiest way of reading a line at a time through a textual CSV
> file, and then extracting the comma-separated elements from each line?

You're probably already set up for this but I just blogged about this if
you're interested.

http://www.softcircuits.com/Blog/post/2010/01/21/Reading-and-Writing-CSV-Files-in-MFC.aspx

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


From: Stanza on
> Stanza you really could short circuit the craziest here by describing
> what language and platform you are using or want this solution. It
> would certainly help GORAN! :)

I'm using VC++ and MFC, that's why I posted on the "vc.mfc" newsgroup.

From: Goran on
On Jan 23, 8:27 pm, Hector Santos <sant9...(a)nospam.gmail.com> wrote:
> Goran wrote:
>
> > I have never seen HTTP escaping in CSV files.
>
> I'm sorry about that.  But its out there, maybe because layman web
> programmers were trying put CSV lines over HTTP and it was naturally
> escaped, but whatever reasons, its out there.
>
> > I know of two relevant
> > conventions: "Unix" one for D(elimiter)SV files, where escape
> > character is backlash, and "Windows" (RFC 4180) one, with quote
> > character escaping. What the hell do you think are you doing,
> > inventing things like that?
>
> I knew Yakov, and RFC 4180 was written in 2005, and ABSOLUTELY, check
> it out, http-like %XX escaping is a recommendation.  But practically
> applications predated Yakoc RFC recommendation by several decades!

OK, I have re-checked it out. There's no recommendation to use HTTP-
escaping in the RFC, nor in prior informal explanations prior to it
(e.g. http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm). So it
looks that you can't read. Or.. Wait! Do you think that use of %XX in
the ABNF grammar proposed by the RFC means that HTTP escaping should
be used in CSV files? Bwahahahaaaaa...

Also, can you tell me what widely available program used to view CSV
recognizes HTTP escaping? E.g. my Excel does not seem to do it and I'd
be surprised if OO did, but I won't be arsed to check.

Here's how things stand: perhaps some poor deluded souls did use HTTP
escaping in CSV files. That doesn't mean it has any bearing to the
rest of the sane world.

> And who's reinventing things, I'm not the trying to change CSV to DSV.
> its COMMA, ok?

Not OK.

About DSV: it's a long standing tradition in Unix world. Google it,
here's help: http://www.google.com/search?q=Unix+DSV.

In 4180, it's a comma. In real world, on Windows, it's locale list
separator, often resulting in e.g. semicolon. If you offer comma-
separated file to someone in e.g. France, he will quite likely tell
you that your file is broken. AFAIK, Excel obeys locale list
separator, and you can certainly change that. Given that RFC is quite
recent, I'd be wary of prior use of other separator characters. If
nothing else, because some DSV files are known to be written prior to
it.

> Well, good luck in trying to stop it because generally most
> programmers are interesting in knowing how to write code, not always
> depend on others!!

Well, I don't know about most programmers, but good programmers know
when to avoid writing code. That includes when problem is solved
dozens times over, like this one.

> Sound like you would are not very good at neither!
> Really, you are not. Honestly. I would never hire a person like you

Irrelevant, 'cause I've seen code you posted here. Based on that,
there's no way I'd come to work for you - it was laughable.

Goran.
From: Hector Santos on
Goran wrote:

> OK, I have re-checked it out. There's no recommendation to use HTTP-
> escaping in the RFC, nor in prior informal explanations prior to it
> (e.g. http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm). So it
> looks that you can't read. Or.. Wait! Do you think that use of %XX in
> the ABNF grammar proposed by the RFC means that HTTP escaping should
> be used in CSV files? Bwahahahaaaaa...


I mis-spoke on this one. Its a recently new recommendation. As I
mentioned a few messages:

- It takes two to tango, writer/reader normally work in
concern,

- There are "http" escaping use cases, to suggest there are
not is not correct.

> Well, I don't know about most programmers, but good programmers know
> when to avoid writing code.


Well most good programmers know that is not correct, especially, in
cases like CSV as it was shown over and over again.

> That includes when problem is solved dozens times over, like this one.


So. It doesn't mean anything as it was shown over and over, not even
the best library can cover all bases, and even it did a good job, you
still need to know what you are doing.

>> Sound like you would are not very good at neither!
>> Really, you are not. Honestly. I would never hire a person like you
>
> Irrelevant, 'cause I've seen code you posted here. Based on that,
> there's no way I'd come to work for you - it was laughable.


Yes it is laughable. At least I put the effort and have quality
products in the market place for 30 years. Do you? You rather depend
on others to do your work. Hey, if that is your preference, cool,
maybe that is your way of keeping up and basic level understanding of
problem solving. Some people are actually pretty good using this
method. You don't seem to be one of them.

---
HLS
From: Pete Delgado on

"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
news:s33ll5l35qnknus8i1n06qitu1r5f750jv(a)4ax.com...
> On Fri, 22 Jan 2010 23:44:44 -0500, Hector Santos
> <sant9442(a)nospam.gmail.com> wrote:
>
>>Joseph M. Newcomer wrote:
>>
>>> This code looks like something from K&R C programming first edition.
>>
>>
>>HA! you shouldn't be ashame about it, Joey! You're too easy. :)
>
> Huh? I'd be embarassed to publish an algorithm that was based on K&R C.
> It represents
> the best of mediocre programming of thirty years ago. When I first read
> it, in 1975, I
> said "This language is really badly done",

From my understanding, the book wasn't published until 1978! ;-) You may
have been thinking of the version of the C reference manual that was
provided with the Unix operating system.

Other than that little nitpick, I think you are confusing the defects in the
implementation of the standard library with the true language defects.
Additionally, I think to compare a 30+ year old language that was originally
designed as a system implementation language with the modern general purpose
languages of today is misleading. C met its goals and became wildly
successful despite its flaws and is still very widely used even today.

-Pete




-Pete