S
Steve Hemond
Hi gurus,
I read some docs about Perl and I think it would be the best language to
suit my acutal need.
I have to change plotter pen widths from an HP/GL2 output file with specific
widths. An HP/GL2 is a plain-text file filled with plotter commands. The
one I need to check are :
PSx (where x = pen number) = PEN SELECT
PWx (where x = width) = PEN WIDTH
In that kind of file, you will see PS1 followed by a bunch of coordinates
and stuff. From there you can see that every command after the PS1 is for
the PEN NUMBER ONE. I have to check where the PW is, and affect a new width
right after it. I have to do this to all pens. I already know which width
goes for each pen. My problem is that the number of caracters between each
PSx and PWx are different from time to time.
Unless anyone has a better idea it would probably need to read the file byte
per byte, and when a PSx is read, the program will remember the current
pen, and when reaching the next PWx, it will affect the corresponding width
for the current pen.
Is there an quick and effective way to do such kind of things with Perl?
From what I've read, I can make a Perl script read a file LINE by LINE but
I don't know about reading byte per byte.
Any ideas?
Thanks in advance,
Steve
I read some docs about Perl and I think it would be the best language to
suit my acutal need.
I have to change plotter pen widths from an HP/GL2 output file with specific
widths. An HP/GL2 is a plain-text file filled with plotter commands. The
one I need to check are :
PSx (where x = pen number) = PEN SELECT
PWx (where x = width) = PEN WIDTH
In that kind of file, you will see PS1 followed by a bunch of coordinates
and stuff. From there you can see that every command after the PS1 is for
the PEN NUMBER ONE. I have to check where the PW is, and affect a new width
right after it. I have to do this to all pens. I already know which width
goes for each pen. My problem is that the number of caracters between each
PSx and PWx are different from time to time.
Unless anyone has a better idea it would probably need to read the file byte
per byte, and when a PSx is read, the program will remember the current
pen, and when reaching the next PWx, it will affect the corresponding width
for the current pen.
Is there an quick and effective way to do such kind of things with Perl?
From what I've read, I can make a Perl script read a file LINE by LINE but
I don't know about reading byte per byte.
Any ideas?
Thanks in advance,
Steve