Author Topic: Whats wrong with this program  (Read 1181 times)

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Whats wrong with this program
« 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++).

flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
Whats wrong with this program
« Reply #1 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]
"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Whats wrong with this program
« Reply #2 on: 29 March 2003, 18:06 »
No i want a char each keypress so it looks like you are typing them.

flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
Whats wrong with this program
« Reply #3 on: 29 March 2003, 18:10 »
Just change %d to %c then.
"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Whats wrong with this program
« Reply #4 on: 29 March 2003, 18:18 »
I did and thanks, it works...
http://users.bigpond.com/tate0/shit/swear.c

NOW THATS CURSES ;)