David Cleaver on Tue, 05 Feb 2008 00:51:45 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Question on input from a file...



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.

Also, if you want to stick snippets in files, note that 'gp' likes statements on one (virtual) line, so if you want to split this across lines, as you do in your snippet, enclose the lines in "{}".

This helped as well.


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?


Hope that helps.

Justin

Again, thank you for your help.

-David C.