问题
I'm using Codeblocks to coding my things using C++.
I remember that in C i can use gotoxy() features and textcolor(), but in C++ that library doesn't work.
Any idea?...
How can i use those functions in C++?.
回答1:
gotoxy()
and textcolor()
are system dependent functions. They are not part of the standard and not portable.
Two possibilities:
with the same development environment you can get them to work in C and not in C++. In this case, its certainly
conio2.h
which doesn't provide forextern "C"
for the C functions. The linker will not find them for this reason.with your new development environment these functons are not provided:
- If you're under windows, you can have a look at this SO question to see how to create your own.
- If you're under Linux, you'd better have a look at the curses/ncurses library. Or use it to emulate
gotoxy()
as explained here.
来源:https://stackoverflow.com/questions/33617109/how-to-use-gotoxy-and-textcolor-in-c