[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Help for programming in C



Sukrit K Mehra forced the electrons to say:
> I am learning to program in C and I have problems learning things on linux as
> most books have dos in mind. How do I avoid that?

Hmm... ever tried Kernighan & Ritchie, The C Programming Language,
2nd edition?

_After_ mastering that, you can try Advanced Programming in the Unix
Environment, W. Richard Stevens.

> #include "curses.h"

#include <curses.h>

> main()

int main (void) is the correct way.

> {
> 	char buff[31];
> 	initscr();
> 	clear();
> 	flushinp();
> 	addstr("Enter your String :");
> 	refresh();
> 	getstr(buff);

Not safe. Try 
getnstr (buff, sizeof buff);

> 	clear();
> 	move(5,30);
> 	addstr(buff);
> 	refresh();
> 	getch();
> 	endwin();
> }
> 
> Why doesn't this program run. Has the cruses been changed... with effect from
> ncruses. 

You didn't mention the error you got. If it is a linker error, you have
to add -lcurses to the compilation command line.

> What books should I read...One of my friends was saying that getch() function
> act different from dos version.. Is that true... Is there a programming how to
> that points out all these differences etc somewhere on the net. 

I don't know how the dos getch() function works, so I cannot comment
on that.

Stevens above is, in my opinion, the most authoritative book that you
can find anywhere on Unix programming.

> Ps... maybe somebody could point me to a nice mailing list on C and related
> topics. 

If you are talking about ANSI C, try the newsgroup comp.lang.c. Some
great C experts post there. For Linux programming, you are at the
right place - also, you can try comp.unix.programmer for generic Unix
programming issues. Both newsgroups are accessible from www.my-deja.com.

Binand