My money's on the first or last one working. (Obviously this assumes you _have_ a `C:\users` directory) I would similarly bet that you might need to capitalize the drive, even though Windows drive letters are case insensitive (https://msdn.microsoft.com/en-us/library/windows/desktop/aa3...). So if it doesn't work with lowercase letters, try it as above.
I've seen this before. What's happening, somehow, is that every time you write more than one line in a definition at the REPL in a Windows prompt, a capital R is being inserted at each newline. Arc compiles this to the Racket code _R, and when Racket executes this, it can't find the _R variable.
I seem to remember I used work around this by always pasting my multi-line definitions from a text editor rather than writing them directly at the REPL.
Oh, sorry. Now that I test it, I realize I remembered incorrectly.
The only time I get those spurious R characters is when I paste code into the REPL and then press enter manually. I don't get them when typing multi-line definitions directly at the REPL, and I don't get them if the code I'm pasting already has a line break at the end.
So the habit I've formed is to make sure the code I'm pasting already has a line break at the end.
I notice this issue also happens on Racket 5.3.3 -- I'm a few versions behind -- and it does not happen in the REPLs for Node.js or Clojure. It's some kind of bug in Racket. (Hmm... Racket's port.c has a bunch of spaghetti code for CRLF processing. Maybe the bug's in there somewhere.)
Can you try it without the drain, just read the first line from the file?
Edit 10 minutes later: here's a few things I would try:
; a relative path with no slashes/backslashes
; inline read-all
(w/infile file "mccf2.txt" (drain (readline file)))
; try reading just the first line
(w/infile file "mccf2.txt" (readline file))
So it looks like the inlined version works, but wrapping it in a function doesn't? Very strange. Paste these lines one at a time into a fresh arc session and show me what you get in response to each line.
(w/infile file "Log.txt" (drain (readline file))) ; just to set a baseline
(def foo (filename) (prn "AAA") (w/infile f filename (prn "BBB") (drain (do1 (readline f) (prn "CCC")))))
(def foo (filename) (prn "AAA") (w/infile f filename (prn "BBB") (readline f)))
I think rocketnia has figured it out. Does rocketnia's comment http://arclanguage.org/item?id=19137 make sense? Basically you shouldn't get an error if you type in this expression character by character, but you should if you paste it into an arc session without a trailing <enter>.