Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: .CHR file read

by keszler (Priest)
on Dec 08, 2011 at 14:53 UTC ( #942456=note: print w/ replies, xml ) Need Help??

in reply to File Reading (.CHR file)

From the lines #!/usr/bin/perl and open (NEWFILE, "C:\\cygwin\\home\\Administrator\\test.chr"); I'm guessing you're running this in a cygwin shell on a Windows box. Does cygwin recognize "C:\\cygwin\\..." as a path, or should it be something like "/home/Administrator/test.chr"?

Comment on Re: .CHR file read
Select or Download Code
Replies are listed 'Best First'.
Re^2: .CHR file read
by johngg (Abbot) on Dec 08, 2011 at 23:04 UTC

    The path should probably be /cygdrive/c/cygwin/home/Administrator/test.chr if the OP's Cygwin installation is anything like mine.



      Now that I'm home, with a box that runs cygwin:
      Windows cmd shell

      C:\cygwin\home\Keszler>dir Directory of C:\cygwin\home\Keszler 12/08/2011 07:33 PM 12 test.chr 12/08/2011 07:35 PM <DIR> x C:\cygwin\home\Keszler>cd x C:\cygwin\home\Keszler\x>dir Directory of C:\cygwin\home\Keszler\x 12/08/2011 07:35 PM 155 C:\cygwin\home\Keszler\x>type #!/usr/bin/perl use strict; use POSIX; use warnings; open (NEWFILE, "/home/Keszler/test.chr"); print "Start"; while(<NEWFILE>) { print $_; } print "end"; C:\cygwin\home\Keszler\x> readline() on closed filehandle NEWFILE at C:\cygwin\home\Keszler\x\te line 7. Startend C:\cygwin\home\Keszler\x>
      cygwin shell
      $ pwd /home/Keszler/x $ ls -l total 1 -rwxr-xr-x 1 Keszler None 155 Dec 8 19:35 $ ls -l .. total 1 -rw-r--r-- 1 Keszler None 12 Dec 8 19:33 test.chr drwxr-xr-x+ 1 Keszler None 0 Dec 8 19:35 x $ cat #!/usr/bin/perl use strict; use POSIX; use warnings; open (NEWFILE, "/home/Keszler/test.chr"); print "Start"; while(<NEWFILE>) { print $_; } print "end"; $ ./ Start1,2,3 a,b,c end $

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942456]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2015-10-06 16:29 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (155 votes), past polls