Author Topic: _setcursortype(); problem  (Read 25421 times)

Deamon

  • Guest
_setcursortype(); problem
« 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:



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
« Last Edit: March 21, 2006, 07:12:02 pm by Deamon »

takeshimiya

  • Guest
Re: _setcursortype(); problem
« Reply #1 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?

Deamon

  • Guest
Re: _setcursortype(); problem
« Reply #2 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

takeshimiya

  • Guest
Re: _setcursortype(); problem
« Reply #3 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 :)

Offline PsYhLo

  • Almost regular
  • **
  • Posts: 157
Re: _setcursortype(); problem
« Reply #4 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

Deamon

  • Guest
Re: _setcursortype(); problem
« Reply #5 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/
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
« Last Edit: March 22, 2006, 04:31:52 pm by Deamon »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: _setcursortype(); problem
« Reply #6 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

Deamon

  • Guest
Re: _setcursortype(); problem
« Reply #7 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

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: _setcursortype(); problem
« Reply #8 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

Deamon

  • Guest
Re: _setcursortype(); problem
« Reply #9 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
« Last Edit: March 28, 2006, 06:18:37 pm by Deamon »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: _setcursortype(); problem
« Reply #10 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

Deamon

  • Guest
Re: _setcursortype(); problem
« Reply #11 on: March 28, 2006, 08:30:31 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

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: _setcursortype(); problem
« Reply #12 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.

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

Best wishes,
Michael

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: _setcursortype(); problem
« Reply #13 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