my code compiles
when i run the code
./a.out >ou
i get on stdout several lines
error in line 1: syntax error
although i think output is correct
what is this error
my code compiles
when i run the code
./a.out >ou
i get on stdout several lines
error in line 1: syntax error
although i think output is correct
what is this error
Since it occurs when actually running your program, you have to know what the error is.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
If that thing compiles, turn up your warnings. A syntax error means you're using incorrect syntax in your code (missing semi-colon, missing parentheses, who knows ?).
Your next step is to post your code.
Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction
that code compiles ..
this is the runtime error i am getting .. i only added 10-20 lines from last code . which didnt gave error
but notice that this error is on stdout when running code and even as i am directing output to ou file. my code is running even after this. bur dunno if it is correct
Your program propably writes to stderr then ( you are redirecting stdout only ). My best guess is that this messages come from some assertions or some debugstatements from a library you are using.Originally Posted by B.S.F.
Kurt
ya you may be correct i am using execl in my code. and i dont have any idea what the called program does.Originally Posted by ZuK
> and i dont have any idea what the called program does.
It's a bit risky isn't it, calling something without knowing what it does?
Can you run that program from the command line OK, and if so, what command line do you give it?
Are you really sure you're doing the same with execl() ?
Post some code. Simply saying "it doesn't work" isn't helpful.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
i got the error. when the file passed to the command "concepts" is empty . it gives this error.i checked it on prompt. and it writes output to stderr
Code:execl ("/usr/local/bin/concepts", "concepts", "-c", "-f", "%O:%a%n", "conceptin", "-o", "concep", 0);
have you tried to run concepts program from the command prompt with the parameters that give you error?
I think it is a regular output of this program when the parameters don't match its requirements
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
A couple of things to try
1. Make argv[0] an absolute path as well. The program may be using it to find other things
This will at least match the way the shell invokes the program.Code:execl ("/usr/local/bin/concepts", "/usr/local/bin/concepts", "-c", "-f", "%O:%a%n", "conceptin", "-o", "concep", 0);
2. At the shell prompt, type in
If that is what gets printed, then OK.Code:echo concepts -c -f %O:%a%n conceptin -o concep
If the shell is taking say "%O:%a%n" and doing lots of parameter expansion or substitution, then you need to take this into account in your execl call. It won't be happening automatically for you anymore.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.