getch() equivalent on osx?

Apprentice
Posts: 18
Joined: 2006.11
Post: #1
what is the equivalent of getch() on osx? if there is one

note: if anyone knows of a resource that lists osx equivalents of commonly used windows functions and system calls i would really like the url
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #2
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
Mac OS X has getch, though whether it's the same as the windows one or not, I don't know.
Code:
man getch
Quote this message in a reply
Apprentice
Posts: 18
Joined: 2006.11
Post: #4
found that^, used it, and i got two different errors depending on if i allow zerolinking or not

if i allow zerolinking i get the error "ZeroLink: unknown symbol '_stdscr'" when i run it, if i disable zerolinking i get an error while building saying "Undefined ymbols:"

the error has something to do with the curses.h header that getch() is in, when i comment out that header and replace getch() with cin just to test it builds and runs fine

little help?


side problem: im also using system("clear"); in the same program and when running it says "TERM environment variable not set.", what do i need for that to work properly
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #5
Under your build rules, add "-lcurses" to your additional linker flags. (basically, you need to link the library before you can actually use it)
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
not -lncurses?

to get TERM set properly, run it from the terminal, instead of from Xcode.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #7
Or that one. Rasp
Quote this message in a reply
Apprentice
Posts: 18
Joined: 2006.11
Post: #8
i added -lcurses to "other linker flags" (im assuming its the same thing) and i still get the same error if i have zeroLink enabled and it opens the dubugger when i run if i have zeroLink disabled :/

edit: i changed it to -lncurses and it does the same thing...
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #9
Are you sure that it's set in your current build setting? (it would actually be best if you entered it when set to all build settings)
Quote this message in a reply
Apprentice
Posts: 18
Joined: 2006.11
Post: #10
^i think so... i went to SCM -> configure SCM, clicked on the "Build" tab, found the "Other Linker Flags" setting and added "-lncurses"

would i have to add something for other headers i included? (theres iostream, string, and curses.h)
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #11
SCM stands for source code management (CVS, SVN, etc.) so it doesn't sound like the right place. Find your target in the left column, and get info on that.
Quote this message in a reply
Apprentice
Posts: 18
Joined: 2006.11
Post: #12
heres a screenshot of the specific error (i think) if any of you have the knowledge to understand what it means

i added curses.h (header getch() is in) to the "Link Binary With Libraries" folder, it just added it to my source files, i ctrl-clicked on "Targets" and clicked "Get Info" and it brings up a box saying "Nothing to inspect", same thing on "Link Binary With Libraries" and it brings up a comment box, same thing again on the pong folder under targets and it brought up a window very similar to the "Configure SCM" window, i checked the "other linker flags" property and -lncurses was already listed there, i then found 3 similar properties "Additional Strip Flags", "Other C Flags", and "Other C++ Flags" and added -lncurses to all of those, still same problem..

P.S. sorry if im giving too many details, just trying to be thorough

[Image: picture1vo8.png]
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #13
Right-click on the "pong" target and choose get info.
Quote this message in a reply
Apprentice
Posts: 18
Joined: 2006.11
Post: #14
OneSadCookie Wrote:Right-click on the "pong" target and choose get info.

Quote:same thing again on the pong folder under targets and it brought up a window very similar to the "Configure SCM" window,
already did
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #15
What's it set at under Configuration? (note that it would be best if you set it to "All Configurations" so the linker flag works under every configuration
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  py2app usage, and windows equivalent? purplemaji 1 2,853 Oct 24, 2006 02:00 AM
Last Post: aarku