News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

_setcursortype(); problem

Started by Deamon, March 21, 2006, 07:07:55 PM

Previous topic - Next topic

Deamon

Hi folks,

i thought to give C::B a try along my OGRE project. Tried to compile some of my old console code that i have developed under Borland Builder 5 but encountered a problem with the _setcursortype(); function.

Actualy the cursor don't do what it supposed to do and i don't know why.

When i compile my hello world app with _setcursortype(_NOCURSOR); the cursor appears like this:



Not that it just appears as a normal cursor it also appears on the top of the line and not on the bottom of it :?

When i compile it with _setcursortype(_NORMALCURSOR); the cursor appears not as a normal cursor but as a half solid cursor !!!



When i compile it with  _setcursortype(_SOLIDCURSOR); it appears as its supposed to:



I tried it with GNU and also Borland 5.5 compiler but with the same results

I have no clue WTF is wrong  :?

Anybody ?

Deamon

takeshimiya

_setcursortype() is not ANSI/ISO C neither POSIX standard.
It came with conio.h provided with old borland compilers, it's not standard, and obviously not portable.

Do you really need that non-standard non-portable functionality?

Deamon

Quote from: Takeshi Miya on March 21, 2006, 07:59:05 PM
_setcursortype() is not ANSI/ISO C neither POSIX standard.
It came with conio.h provided with old borland compilers, it's not standard, and obviously not portable.

Didn't knew that. Thanks.

QuoteDo you really need that non-standard non-portable functionality?

If there is no ANSI compliant equivalent then yes! Is there any ?

Is there a way to let the Compiler use this old conio.h ?

EDIT: Is there any online documentation or docs for download that explain all the functions of the ANSI .h's ?

regards
Deamon

takeshimiya

Quote from: Deamon on March 21, 2006, 09:35:09 PM
If there is no ANSI compliant equivalent then yes! Is there any ?
Not that I know, probably not, because it's not something portable.

Quote from: Deamon on March 21, 2006, 09:35:09 PM
Is there a way to let the Compiler use this old conio.h ?
I don't know but I wouldn't advice that.

Quote from: Deamon on March 21, 2006, 09:35:09 PM
EDIT: Is there any online documentation or docs for download that explain all the functions of the ANSI .h's ?
Yes, here http://www.cppreference.com/ or here: http://www.google.com :)

PsYhLo

Deamon use conio2 this is an opensource project on sourceforge.net http://conio.sourceforge.net/
it is very useful
[url="http://img529.imageshack.us/img529/822/3664286vy.png"]http://img529.imageshack.us/img529/822/3664286vy.png[/url]

Deamon

#5
Quote
Quote from: Deamon on March 21, 2006, 09:35:09 PM
EDIT: Is there any online documentation or docs for download that explain all the functions of the ANSI .h's ?
Yes, here http://www.cppreference.com/

Thanks. But it looks like it doesn't describe all the C++ headers.

Quote from: PsYhLo on March 22, 2006, 02:51:45 PM
Deamon use conio2 this is an opensource project on sourceforge.net http://conio.sourceforge.net/
it is very useful

Hey conio is back !  :)  Found it just yesterday. This is great actualy, cose my console app builds heavily on it. It's so damn handy.

How to make it work with C::B ?

Is it enough to just drop it in to the include folder of gcc or Borland 5.5 ?

And what do i do with the DevPack file of it ?

EDIT: BTW is there a way to change the resolution of the console ?

regards
Deamon

Michael

Quote from: Deamon on March 22, 2006, 04:24:28 PM
And what do i do with the DevPack file of it ?

C::B has a plugin for it, i.e., Dev-C++ DevPacks updater/installer  :).

Best wishes,
Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Deamon

Quote from: Michael on March 22, 2006, 04:36:01 PM
Quote from: Deamon on March 22, 2006, 04:24:28 PM
And what do i do with the DevPack file of it ?

C::B has a plugin for it, i.e., Dev-C++ DevPacks updater/installer  :).

Best wishes,
Michael


Sorry for my newbishness but what am i supposed to do with this DevPack now ?

Should i put it into some folder or open it with what ?

regards
Deamon

Michael

Quote from: Deamon on March 22, 2006, 05:18:29 PM
Sorry for my newbishness but what am i supposed to do with this DevPack now ?

Should i put it into some folder or open it with what ?

Hello,

There are (IIRC) one or two posts which should help you out. Try a search on the Code::Blocks forum.

Best wishes,
Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Deamon

#9
Ok i unziped the devpack but one question remain: How do i make the conio2.h run ? I putted it in to the include folder of the Borland 5.5 compiler but when i include it in the code it gives me error messages. I also tried to include it from another folder but with the same results:

Error E2238 D:\Programme\DevPack\conio_content\include\conio2.h 30: Multiple declaration for 'BLACK'
Error E2344 D:\Programme\CodeBlocks\share\CodeBlocks\plugins\compilers\BCC55\Include\conio.h 56: Earlier declaration of 'BLACK'
Error E2238 D:\Programme\DevPack\conio_content\include\conio2.h 31: Multiple declaration for 'BLUE'
Error E2344 D:\Programme\CodeBlocks\share\CodeBlocks\plugins\compilers\BCC55\Include\conio.h 57: Earlier declaration of 'BLUE'
Error E2238 D:\Programme\DevPack\conio_content\include\conio2.h 32: Multiple declaration for 'GREEN'
Error E2344 D:\Programme\CodeBlocks\share\CodeBlocks\plugins\compilers\BCC55\Include\conio.h 58: Earlier declaration of 'GREEN'
Error E2238 D:\Programme\DevPack\conio_content\include\conio2.h 33: Multiple declaration for 'CYAN'
Error E2344 D:\Programme\CodeBlocks\share\CodeBlocks\plugins\compilers\BCC55\Include\conio.h 59: Earlier declaration of 'CYAN'
Error E2238 D:\Programme\DevPack\conio_content\include\conio2.h 34: Multiple declaration for 'RED'

So how to make it run ?

Is it meant to run only with MingW compiler ?

I also tried it with MingW, means i putted it in to the include folder of MingW but it then complains:

.objs\main.obj(.text+0x24):main.cpp: undefined reference to `_setcursortype'

Deamon

Michael

From here, did you:

Quote
2. Link with libconio.a (add -lconio parameter to linker).

Best wishes,
Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Deamon

Quote from: Michael on March 28, 2006, 06:37:20 PM
From here, did you:

Quote
2. Link with libconio.a (add -lconio parameter to linker).

Best wishes,
Michael


Me idiot. Thank you so much. It works now. Well, kinda. It display _NOCURSOR as a _NORMALCURSOR and _NORMALCURSOR as a half _SOLIDCURSOR and _SOLIDCURSOR as _NOCURSOR.  :?

Anyone experianced the same ? Do i still do something wrong ?

When i open conio2.h and change this values:

#define _NOCURSOR 0         /**< no cursor */
#define _SOLIDCURSOR 100    /**< cursor filling whole cell */
#define _NORMALCURSOR 20    /**< cursor filling 20 percent of cell heigh */

to:

//#define _NOCURSOR 100         /**< no cursor */
//#define _SOLIDCURSOR 99    /**< cursor filling whole cell */
//#define _NORMALCURSOR 10    /**< cursor filling 20 percent of cell height */

It finaly works properly. Still it's weired !

BTW: Talking about -lconio parameter. Is it right to put it to Settings -> Compiler -> Linker tab -> Other linker options field ?

And when ever i want to put several parameters is the "-" enough to separate them from each others or is a "," necessary ?

regards
Deamon

Michael

Hello,

May be you can try the conio forum and/or mailing list, though they seem not very active :(. Look at here.

You can also try to report the problem ("bug") you have.

Best wishes,
Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Michael

Quote from: Deamon on March 28, 2006, 08:30:31 PM
BTW: Talking about -lconio parameter. Is it right to put it to Settings -> Compiler -> Linker tab -> Other linker options field ?

Well, libconio.a would be -lconio :). Simply add the libconio.a to the linker-->Link libraries and the directory path into the directories-->Linker.

Best wishes,
Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]