Missed the fact that you are using seek, sorry.

Don't know about the consistency of $^O, WinME returns "MSWin32" if that's
any help to you.

Mike

----- Original Message -----
From: "David Falck" <[EMAIL PROTECTED]>
To: "Mike Lacey" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, May 14, 2001 2:46 AM
Subject: RE: CR LF with UNIX and Windows (DOSish?)


> Mike,
>
> Thanks for your response. Yes, Perl knows which system it's on, and
because
> of this I have no problem when writing the record. But because I'm doing a
> seek when reading the record I have to account for every byte in my
> algorithm below. So I thought my solution would be to determine the
> operating system.
>
> My concern is - does Windows always include MS or Win in the name of ALL
> their operating systems, so I can match $^0 against those values?
>
> Thanks,
> David
>
> -----Original Message-----
> From: Mike Lacey [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 13, 2001 9:26 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: CR LF with UNIX and Windows (DOSish?)
>
>
> David,
>
> My understanding is that you don't need to worry about what character(s)
> contitute a newline. The different versions of Perl know about this and do
> what you would expect.
>
> So \n on UNIX is a LF and CRLF on DOS.
>
> Did you already try this and encounter problems?
>
> Mike
> ---
> Mike Lacey
>
> www.tek-tips.com -- a friendly, flame free, environment for computer
> professionals and students
> Perl forum at:
> http://www.tek-tips.com/gthreadminder.cfm/lev2/4/lev3/32/pid/219
>
>
> ----- Original Message -----
> From: "David Falck" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, May 14, 2001 2:15 AM
> Subject: CR LF with UNIX and Windows (DOSish?)
>
>
> > Is there a programmatic way to tell if I'm on Windows or UNIX? I know
that
> > $^0 returns the name of the operating system, but can I count on
matching
> > /MS/i or /Win/i to determine if it's Windows? If Windows, I'll assign 2
to
> > $newline below, else I'll assign 1.
> >
> > Problem:
> > I have a fixed length customer record. When I create the record, I add
\n.
> > But my testing tells me that when I read (seek) the record below, I have
> to
> > add 2 for Windows or 1 for UNIX.
> >
> > # Customer file data  -
> > $cst_template =
> > "A9A15A15A1A30A30A30A30A9A2A13A40A13A5A2A16A2A2A1A1A10A10A10A7";
> > $cst_rec_len = 303;                       # sum all customer fields
> > $newline = 2;                             # changes based on OS
> > $cst_offset = $cst_rec_len + $newline;
> >
> > # reading the customer record
> > seek(CSTMST, ($rec_nbr * $cst_offset), 0) # $rec_nbr is the physical
> record
> > number
> >
> > Solution:
> > Remove the hard coding above for $newline. Then assign 2 to $newline if
> > Windows, else assign 1 to $newline. But do I look at $^0 to determine
the
> > operating system, or is there a better way?
> >
> > Thanks,
> > David
> >
>
>

Reply via email to