C question, mates. I have this file which has System V Unix code for getchar (modified by me to avoid echo from the key pressed into the terminal), and I have a simple function to print out sudoku rules as a helper. Thing is, even after calling tty_fix(), the terminal is still without the echo, when it should have gone back at the initial state. Every other function works great after calling tty_fix, except this one. Here is the input file: http://codepad.org/yCsKGTOS Here is the problematic function: http://codepad.org/F438uY2y Thanks in advance :-)
Way out of my domain of expertise :(
I believe that TRUE has to be declared in an enum or #define
It's already defined. It is defined as 1, STDERROR as -1 and FALSE as 0. Anyway, I am quite puzzled by this. I will try to modify it latter.
I don't see it defined anywhere in the two posted files, and it's what the compiler is complaining about.
I mean it's defined somewhere in the project, and that's not the issue. The code compiles fine, just the terminal doesn't reset to what it was before after I call sudoku_rules() and it resets after calling every other function just as it should.
Two things: what value is sudoko_rules() returning? FWIW, I'm a bit surprised that sudoko_rules() doesn't call tty_fix() since it does (maybe) call tty_break().
It returns 1 if tty_break() is some other value that not zero, and zero if everything goes well. Thing is, I only call tty_fix once in my code, in the 'main' file, that is the interface program, with documentation, and everything. This file has three purposes: seed the rand function, calling the menu function from the client file and calling tty_fix(). This set-up works well with everything, except sudoku_rules() :-( I feel that I am missing something silly, and that annoys me.
I'm sorry, when I said what value does sudoko_rules() return, I was thinking more of printing it to, say, stderr to see what is actually going on. Other than what I've mentioned, I don't see anything with the code.
Join our real-time social learning platform and learn together with your friends!