|Justin C. Walker on Tue, 05 Feb 2008 01:16:49 +0100|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: Question on input from a file...|
On Feb 4, 2008, at 05:49 , David Cleaver wrote:
Justin C. Walker wrote:One thing to keep in mind when tracking down these syntax errors is that 'gp' likes to have its "instructions" separated by ";". What these errors tell you is that you need a few of these :-} In particular, look at the last 'write', and the 'str_line' before the last 'for' statement.Aha! This helped tremendously. It actually turns out that gp was looking for me to put ';' after each of the 'for' statements as well. It now works perfectly. Thanks for the help.
Rats. I neglected to mention them all. Sorry about that.
And a final note to ease typing burdens :-} you can use "\r /path/ to/file" (no quotes) in place of read("/path/to/file"). If the file is in the directory you were in when you ran 'gp', you can drop the "/path/to/".Its strange. I have a variable defined that contains a string pointing to the file in question, lets call it str_file. When I type '\r str_file', its acting like str_file "is" the file I want to open and says "error opening input file: str_file" with a little arrow pointing to the 's' in str_file. However, when I call read (str_file) it works just fine. Am I calling '\r' incorrectly?
The "\r" command takes a literal, unquoted, sequence of characters as it's argument. That's why you get that behavior. If you want to do that, use "read()", because it expects a string, and your variable will evaluate to a string before the call is made.
Hope that clears it up. Justin -- Justin C. Walker, Curmudgeon-At-Large Institute for the Enhancement of the Director's Income -------- Experience is what you get when you don't get what you want. --------