0

Hello,

I've got this array defined as a global just to test...

char RW[100];

but its giving me grief when I try to use strcpy with it...

I'm putting since varibles and longer ones too thats all I can think of as the cause of my problems

.. error quote:

C:\Documents and Settings\Administrator\Desktop\ScannerOOp.cpp(162) : error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

ScannerOOp.exe - 1 error(s), 0 warning(s)

line of code:

case 'i': // reconize if's
             if (array[++j] == 'f')
                 //RW[h] = "if";
	strcpy(RW[h],"if");
	h++;
                    break;

I've tried delcaring it as strings arrays but no luck since st->Lenght() only returns 3 everytime and dont know why ?? can someone help me out please?

Thanks,

John

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by Acidburn
0

RW[h] is just the h'th character in the array -- strcpy wants a pointer to a character array. make a character pointer as shown below -- assuming h is the index into the array where you want to copy the string.

strcpy(&RW[h],"if");
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.