Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Deamon on March 21, 2006, 07:07:55 pm

Title: _setcursortype(); problem
Post by: Deamon on March 21, 2006, 07:07:55 pm
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:

(http://www.dreadnoughtproject.org/heinrich/Media/Images/ForumPics/nocursor.jpg)

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 !!!

(http://www.dreadnoughtproject.org/heinrich/Media/Images/ForumPics/normalcursor.jpg)

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

(http://www.dreadnoughtproject.org/heinrich/Media/Images/ForumPics/solidcursor.jpg)

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
Title: Re: _setcursortype(); problem
Post by: takeshimiya 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.

Do you really need that non-standard non-portable functionality?
Title: Re: _setcursortype(); problem
Post by: Deamon on March 21, 2006, 09:35:09 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.

Quote
Do 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
Title: Re: _setcursortype(); problem
Post by: takeshimiya on March 21, 2006, 09:53:22 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.

Is there a way to let the Compiler use this old conio.h ?
I don't know but I wouldn't advice that.

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 :)
Title: Re: _setcursortype(); problem
Post by: PsYhLo on March 22, 2006, 02:51:45 pm
Deamon use conio2 this is an opensource project on sourceforge.net http://conio.sourceforge.net/ (http://conio.sourceforge.net/)
it is very useful
Title: Re: _setcursortype(); problem
Post by: Deamon on March 22, 2006, 04:24:28 pm
Quote
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.

Deamon use conio2 this is an opensource project on sourceforge.net http://conio.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
Title: Re: _setcursortype(); problem
Post by: Michael on March 22, 2006, 04:36:01 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
Title: Re: _setcursortype(); problem
Post by: Deamon on March 22, 2006, 05:18:29 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
Title: Re: _setcursortype(); problem
Post by: Michael on March 22, 2006, 05:58:12 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
Title: Re: _setcursortype(); problem
Post by: Deamon on March 28, 2006, 06:01:57 pm
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
Title: Re: _setcursortype(); problem
Post by: Michael on March 28, 2006, 06:37:20 pm
From here (http://conio.sourceforge.net/docs/html/index.html), did you:

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

Best wishes,
Michael
Title: Re: _setcursortype(); problem
Post by: Deamon on March 28, 2006, 08:30:31 pm
From here (http://conio.sourceforge.net/docs/html/index.html), 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
Title: Re: _setcursortype(); problem
Post by: Michael on March 28, 2006, 08:50:38 pm
Hello,

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

You can also try to report (http://sourceforge.net/tracker/?atid=673250&group_id=115967&func=browse) the problem ("bug") you have.

Best wishes,
Michael
Title: Re: _setcursortype(); problem
Post by: Michael on March 28, 2006, 09:23:08 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