|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi Folks,
I've been trying to read in a text file and can
make no sense of the end results
Create a file named text.txt and put the following into it
-------------BEGIN-----------
"line1"
"line2"
"line3"
"line4"
"line5"
"line6"
-------------END-----------
and then run this code within a scene file (.pov)
-------------BEGIN-----------
#debug "\n--------------------\n"
#declare Lines=0;
#fopen Io "text.txt" read
#while ( defined(Io) )
#read (Io,Pat)
#if ( defined(Io) )
#debug Pat
#debug "\n"
#declare Lines=Lines+1;
#end
#end
#fclose
#debug str(Lines,0,0)
#debug " Lines read"
#debug "\n--------------------\n"
-------------END-----------
My results of running above code gives
-------------BEGIN-----------
line1
line3
line5
3 Lines read
-------------END-----------
The results are the same for line termination being LF's or CR/LF's
Baffled
--
(MIKA) Marc Champagne
marcch.AT.videotron.DOT.ca
Montreal, CANADA
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Marc Champagne <marcch.AT.videotron.DOT.ca> wrote in
news:Xns### [at] 204213191226:
I found my answer (big loop-hole in docs) very very unclear
Data must have commas even at end of lines as CR/LF, LF, spaces, tabs,
basicaly any white space are most problably ignored (unless within quotes
of course...I hope)
Data works when like this
-------------BEGIN-----------
"line1",
"line2",
"line3",
"line4",
"line5",
"line6"
-------------END-----------
Thanks anyways
>
> I've been trying to read in a text file and can
> make no sense of the end results
>
>
> Create a file named text.txt and put the following into it
>
> -------------BEGIN-----------
> "line1"
> "line2"
> "line3"
> "line4"
> "line5"
> "line6"
> -------------END-----------
--
(MIKA) Marc Champagne
marcch.AT.videotron.DOT.ca
Montreal, CANADA
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Marc Champagne" <marcch.AT.videotron.DOT.ca> wrote in message
news:Xns### [at] 204213191226...
>
> -------------BEGIN-----------
> "line1"
> "line2"
> "line3"
> "line4"
> "line5"
> "line6"
> -------------END-----------
>
> My results of running above code gives
>
> -------------BEGIN-----------
> line1
> line3
> line5
> 3 Lines read
> -------------END-----------
Yes, you used it incorrectly. I don't know the real reason why it gathers
every other line but your answer is to add a comma to the end of each line.
--
Farewell,
Bob
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 17 Nov 2002 23:13:41 -0500, Marc Champagne <nos### [at] pleasecom>
wrote:
>I found my answer (big loop-hole in docs) very very unclear
>Data must have commas even at end of lines as CR/LF, LF, spaces, tabs,
>basicaly any white space are most problably ignored (unless within quotes
>of course...I hope)
What's unclear about this sentence? Does it mention line-by-line
reading or anything?
"The format of the data to be read must be a series of valid string
literals, float literals, or vector literals separated by commas."
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Peter Popov <pet### [at] vipbg> wrote in
news:rthhtuc21ujio2ls4ilhtbohqu1enisd7v@4ax.com:
> What's unclear about this sentence? Does it mention line-by-line
> reading or anything?
>
> "The format of the data to be read must be a series of valid string
> literals, float literals, or vector literals separated by commas."
I agree Peter, there is no mention of "lines", but there is also no
mention that white space between fields are ignored.
It's not common in the "Windows way" of handling files (and am by no
means trying to justify it either).
Being a Xenix/Unix buff for (wow, shesh, i'm getting old) 18+ years now,
I have no problems in dealing with file structures, I have seen many
horrors (especially from the Microsoft generation).
I still don't like the 1 liner above to describe a file structure.
I managed to figure it out myself, as I do many times a week at work,
but for the average joe, he/she will most likely make the same
unconscious mistake I did.....defacto-windows-way-text-file.
Much obliged
--
(MIKA) Marc Champagne
marcch.AT.videotron.DOT.ca
Montreal, CANADA
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:Xns### [at] 204213191226 Marc Champagne wrote:
>> "The format of the data to be read must be a series of valid string
>> literals, float literals, or vector literals separated by commas."
>
> I still don't like the 1 liner above to describe a file structure.
>
Is there somebody, able and willing, to write a better documentation
section for the #read directive? Please post it to the
povray.documentation.inbuilt group (as plain text).
Thanks,
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|