[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tutorial to Linux gaming



On Mon, 27 Dec 1999 vilohidi@mbnet.fi wrote:

>In Alexander Courbot's tutorial there was this kind of function as 
>main:
>
>int displaypcx(int argc, char **argv);
>
>I changed it so that it can be called from an other program (I 
>think).
>
>But how should I call it?
>
>char tausta[] = "tausta.pcx";
>int main()
>{
>displaypcx(2, tausta[1]);
>}
>
>warning: passing arg 2 of 'displaypcx' makes pointer from integer
>without a cast

That's right, because you're passing second character of tausta string
(zero-based 1) which happens to be int (characters are of type int).

Thus, for your program to work, you should create array of string
pointers (just like argv) and pass it to displaypcx:

char* tausta[] = {"tausta.pcx"};

int main(void)
{
  displaypcx(sizeof(tausta), tausta);
}

Hope this clears your problem.

--
jonis

I learned to play guitar just to get the girls, and anyone who says they
didn't is just lyin'!
		-- Willie Nelson