Quote:
Originally Posted by
jim mcnamara
I don't want to correct everything....
main is NOT void, it is int. Return to int from main(). Always.
Turn on warnings and every other diagnostic known to the compiler.
Strings in C cannot be less than two characters, if they contain dat. a[1] will not fly generally. Why? they need a terminating nul characters \0 == ascii 0
you do not have all of the #include files required to compile the code.
Read the man page for read & open - it tells you at the top the name of the include file(s)required.
You cannot call a compile ok until:
1. there are zero warnings
2. there are zero errors
Period. Anything else that seems to work is a disaster waiting to happen.
hmm I can compile it with 0 warnings and 0 errors, with int instead of void and adding return 0 at the end and with %d instead of %s, the only problem I have now is that it doesn't print on the second terminal window ttyp1so i think my problem is this line :
ter=open ("/dev/ttpy1",O_WRONLY);
Professor numnuts at college told us that terminals are treated like files and are "mounted" in the /dev/ directory.
As for the missing .h as I said before a have 0 errors so i don`t think that`s the problem, just to be sure I added iostream and fstream .h, and i got invalid library errors on both when I tried to compile.
I am "programing" using a normal text editor and writing in the terminal
#cc program.c -o program