_conio_gettext - strange error

I'm currently making a project on C++ - a rather big one - and, after dealing with the harder (or so I thought) part of the code, I went on to make the graphical parts - to make it look good and all.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio2.h>

int main(){
    char_info ch;
    printf ("                            MAIN MENU                          \n");
    printf (" _____________________________________________________________ \n");
    printf ("|                               |                             |\n");
    printf ("|           REGISTER            |         INFORMATION         |\n");
    printf ("|                               |                             |\n");
    printf ("|_______________________________|_____________________________|\n");
    _conio_gettext (33,6,50,1,18*6*sizeof(ch));
    getch();
    gotoxy (33,3);
    textbackground (WHITE);
    textcolor (BLACK);
    puttext(33,6,50,1,18*6*sizeof(ch));
    getch();
    return 0;
}


I took a sample out of the menu and started working with it. As you can see the main goal was to test the usage of _conio_gettext in arrow key commands (with two options, pressing "left" will light up "information" and "right", "register". I just wanted it to, when part of the screen was already lit up - "information", for example - and you pressed the opposite arrow key it simply switched over).

The error I keep getting is:
invalid conversion from 'unsigned int' to 'char_info*'
initializing argument 5 of 'void _conio_gettext(int,int,int,int,char_info*)

That also on the line that has "puttext", except with "puttext" insted of "_conio_gettext".
So no, it isn't a problem on _conio_gettext, and I know I'm probably being very stupid - I think that I'm overlooking something very important.
18*6*sizeof(ch)
That's a number. An int. The function expects the fifth parameter to be a pointer to a char_info object, but you're trying to give it an int.
Of course!
But I'm a real newbie here... I've tried changing the code, changing it to 18*6*sizeof(*ch)
But the error I get now is
Invalid type argument of 'unary*'

Boy, do I feel stupid right now...
=/
scratch that, what I'm actually getting is
no match for 'operator*' in '*ch'
18*6*sizeof(*ch)


*ch means "dereference the pointer ch" which makes no sense as ch is not a pointer. It could also mean something multiplied by ch which also makes no sense as there is no something and ch is a char, not a number.

That parameter has to be a pointer to an object of type char_info. A char is not the same as a char_info, whatever one of those is.
Topic archived. No new replies allowed.