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

Recommended Answers

All 2 Replies

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");

Thanks dude, its solved the problem for now :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.