Stop Microsoft

Miscellaneous => Programming & Networking => Topic started by: Kintaro on 29 March 2003, 14:47

Title: Whats wrong with this program
Post by: Kintaro on 29 March 2003, 14:47
This program compiles, but there is somthing wrong with the printw bit.

Code: [Select]

I guess i need somthing else instead of %d in the printw for strings and chars to be shown correctly (im used to cout in c++).
Title: Whats wrong with this program
Post by: flap on 29 March 2003, 18:03
The format specifier for printing a string is %s, and char is %c. Although if you'd used %c your code would just print a character at a time, whereas presumably you want to print a word on each keypress?

In which case, your array of words should be more like:

Code: [Select]

Then your loop would be:

Code: [Select]
Title: Whats wrong with this program
Post by: Kintaro on 29 March 2003, 18:06
No i want a char each keypress so it looks like you are typing them.
Title: Whats wrong with this program
Post by: flap on 29 March 2003, 18:10
Just change %d to %c then.
Title: Whats wrong with this program
Post by: Kintaro on 29 March 2003, 18:18
I did and thanks, it works...
http://users.bigpond.com/tate0/shit/swear.c (http://users.bigpond.com/tate0/shit/swear.c)

NOW THATS CURSES ;)