send_to_char problem

Posted by Zeno on Thu 03 Jul 2003 12:22 AM — 6 posts, 15,158 views.

USA #0
Couple of problems here.
I get an error while compiling-
act_info.c:4783: parse error before "Use"

"Use" is part of another line below it, yet on line 4783, its actually
send_to_char( "To what?\n\r\", ch );

The line on 4783 is causing the error, anyone know whats wrong with it and why is shows another line instead of the correct one?

And if it matters, here's the other line.
send_to_char( "Use a number.\n\r", ch );
Amended on Thu 03 Jul 2003 12:23 AM by Zeno
Australia Forum Administrator #1
The backslash before the quote is causing it to be ignored.


send_to_char( "To what?\n\r\", ch );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Amended on Thu 03 Jul 2003 12:28 AM by Nick Gammon
USA #2
Oh, stupid keyboard. Thanks, and any idea why its displaying the wrong line?
USA #3
Actually, it's not displaying the wrong line. It's displaying the line the error triggered on, which is the line AFTER the line with the error in this case. It didn't say the error was actually on line 4783, simply that it triggered at line 4783 after a parse error before the word "Use".
USA #4
Wouldn't it have triggered on the comma on the line, because thats right after the extra backslash...?

[Edit] Nevermind, since the quote was never there, it never ended the line. I see now.
Amended on Thu 03 Jul 2003 02:16 AM by Zeno
Australia Forum Administrator #5
Because the quote was not treated as a quote, it has taken it as:


send_to_char( "To what?\n\r (blah blah) send_to_char( "
Use


Now the word "Use" is the very first word after the string literal terminated, and that caused the error. However I think with warnings ramped up you would have got a warning about string literal spanning newlines.