Re: fgets() equivalent?



"Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx> wrote in message
news:OJghlbpMIHA.2376@xxxxxxxxxxxxxxxxxxxxxxx
"Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx> wrote in message
news:eZmVFaiMIHA.4684@xxxxxxxxxxxxxxxxxxxxxxx
In a tab delimited text file, a tab separates fields within a line, a tab
doesn't separate lines. Oddly this part of it doesn't confuse fgets()
and doesn't confuse Excel, so I'm not sure why it confused you.
["You" was "Pops" there.]
Bare LF characters within a field don't confuse Excel but do confuse
Windows version of fgets(), confuse DotNet even worse, and confuse you.
Bare LF characters in Unix would be a non-issue and that's why my
previous posting didn't even discuss Unix. In Unix any LF character
would end a line, so tab delimited text files don't even work, and they
have nothing to do with raw and cooked.

The tab character is entirely distinct from an LF, so I see no reason that
Unix can't have tab delimited text files.

heading1\theading2\theading3\n
field1\tfield2\tfield3\n

and so on

Excel can write this:

row 1 cell 1 has 1 subline\tcell 2\nhas 3\nsublines\tcell 3 has\n2 sublines\tcell 4\r\n
row 2 cell 1\nhas 2 sublines\cell 2 has 1 subline\t\tcell 4 has 1 subline\r\n

and so on.

If you use Unix native newline \n markers then you can't distinguish the end
of a subline in a cell from the end of a full row.

Now let's suppose you copy a tab delimited file from Windows to Unix. Unix
will not natively distinguish bare \n from Microsoft newline \r\n pairs. If
you use fgets() in Unix then you can put it in a loop and watch for the \r.

But Windows itself is worse. If you use fgets() in Windows then you can't
even see the \r. In Windows you have to read byte by byte.

DotNet is even worse. But the solution is the same; you still have to read
byte by byte.

.



Relevant Pages

  • Re: What is the more popular UNIX flavor?
    ... about my experience with Solaris and Cygwin. ... installing packages. ... needing eg tftp you only need to activate on a Unix system. ... probably need installing first on the equivalent Windows system. ...
    (comp.unix.questions)
  • Re: Five Architectural Flaws in Windows Solved In Mac OS X
    ... But it is still an improvement over Unix, wherein *any executable* can be highly privileged and interact with the user. ... The usual security precautions prevent unauthorized people from doing this, but that's true on Windows also. ... I just got thru upgrading the wifes Mac to Tiger and hpfs is the default. ... This is a more advanced design that Unixes have been trying to duplicate by adding thread support. ...
    (comp.sys.mac.advocacy)
  • Re: Linux no threat to Microsoft
    ... originally developed for Unix. ... Windows has't come on any of the machines I've ever purchased. ... Yet over those years Linux Market Share on the desktop has actually ... philosophy of Apple - later adopted by Microsoft. ...
    (comp.os.linux.setup)
  • Re: OS X "Security" myths
    ... >> lot of UNIX systems down to their knees. ... >>> their code, so they concentrate on developing exploits for Windows, ... > It does tell me that there is not much "boast factor" for malware ... Just like the Hackers convention in Las Vegas known as ...
    (comp.sys.mac.advocacy)
  • Re: Wozu Linux privat einsetzen?
    ... > Open Source bzw. GNU sind nicht an eine bestimmte Plattform gebunden. ... Windows ist nun mal nicht OpenSource. ... > Unix ist genauso gewachsen wie DOS, OS/2, Windows. ...
    (de.comp.os.unix.linux.misc)

Quantcast