how to 'write' cr-nl 
Author Message
 how to 'write' cr-nl

Is there an easy way to write CR-NL at the end of the lines
instead of just "\n".  Sort of like  $\ = "\r\n", except make
it apply to the write statement?

Alternatly is there an EASY way to set the onlcr flag on
STDOUT in some portable way when you don't know for sure
what device it is pointing to (so I can't do system('stty...)..

This must be simple, I've got to be overlooking the easy
solution.




Sat, 18 Feb 1995 00:35:41 GMT  
 how to 'write' cr-nl

watson> Is there an easy way to write CR-NL at the end of the lines
watson> instead of just "\n".  Sort of like  $\ = "\r\n", except make
watson> it apply to the write statement?

What's wrong with:


.

Does this do something that I'm not expecting?

--
--------
Disclaimer: I am solely responsible for the content of this message.
The views expressed here may not be the views of I-Kinetics, Fidelity,
any of the Fidelity-owned corporations or my mother.



Sat, 18 Feb 1995 22:14:15 GMT  
 how to 'write' cr-nl

Quote:


>watson> Is there an easy way to write CR-NL at the end of the lines
>watson> instead of just "\n".  Sort of like  $\ = "\r\n", except make
>watson> it apply to the write statement?

>What's wrong with:

>format STDOUT =

>.

My problem here, besides forgeting to put it in on a line or two, and
creating a debugging mess is possibily

entering spaces after the ^M which are not visible by the vi editor,
creating leading white space on the next line.

With all the printers that don't cr on nl, I just thought there must be
some easy way to do this correctly.

John Watson



Sun, 19 Feb 1995 01:41:20 GMT  
 how to 'write' cr-nl


[...]
|> entering spaces after the ^M which are not visible by the vi editor,
|> creating leading white space on the next line.

vi can always show you what you have by setting list i.e. :set list
as can cat -e, both are extremely usefull.

--

Michael Salmon

#include        <standard.disclaimer>
#include        <witty.saying>
#include        <fancy.pseudo.graphics>

Ericsson Telecom AB
Stockholm



Sun, 19 Feb 1995 14:47:19 GMT  
 how to 'write' cr-nl


: >What's wrong with:
: >
: >format STDOUT =

: >.
:
: My problem here, besides forgeting to put it in on a line or two, and
: creating a debugging mess is possibily
:
: entering spaces after the ^M which are not visible by the vi editor,
: creating leading white space on the next line.

It shouldn't do that, because formats drop any trailing spaces on the line.

Alternative 1.

    format STDOUT =

    $foo,                     $bar,        "\r"
    .

Alternative 2.

    $child = open(STDOUT, "|-");
    die "Phooey" unless defined $child;
    if (!$child) {
        $\ = "\r\n";
        while (<STDIN>) {
            chop;
            print;
        }
        exit;
    }

Larry



Sun, 19 Feb 1995 14:38:34 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Extracting fields from a fixed length file with no nl or cr

2. Binary data and CR-LF's in MSDOS

3. cr's in input text fields screwing up the database (not text area)

4. Help writing 'simple' loop

5. Interacting with output from 'write'

6. Problem compiling 'write'

7. 'seek'ing in a file before writing

8. Apache, embperl, mod_perl : require doesn't work and can't write to file

9. 'write' to non-STDOUT help needed

10. Image::Magick->Write() doesn't want to write

11. HELP: 'write' in perl 5.001 doesn't write "\n"

12. What is pseudorandommy @chars=('a'..'z','A'..'Z','0'..'9','_');

 

 
Powered by phpBB® Forum Software