hi everyone, a friend of mine made a program that was bounded on your mac. a few days ago he released his code and i was interested so i downloaded it. i took the mac retrieving code and placed it in my own code. once all .h and everything were included i compiled but i got an error:
error C2664: 'strcpy' : cannot convert parameter 1 from 'UCHAR [16]' to 'char *'

the void looks like this

void grabmacaddr ( void )
{
	unsigned char client_macaddr[8];

	NCB Ncb;
	UCHAR uRetCode;
	LANA_ENUM   lenum;
	int      i;

	memset( &Ncb, 0, sizeof(Ncb) );
	Ncb.ncb_command = NCBENUM;
	Ncb.ncb_buffer = (UCHAR *)&lenum;
	Ncb.ncb_length = sizeof(lenum);
	uRetCode = Netbios( &Ncb );

	for(i=0; i < lenum.length ;i++)
	{
		memset( &Ncb, 0, sizeof(Ncb) );
		Ncb.ncb_command = NCBRESET;
		Ncb.ncb_lana_num = lenum.lana[i];

		uRetCode = Netbios( &Ncb );

		memset( &Ncb, 0, sizeof (Ncb) );
		Ncb.ncb_command = NCBASTAT;
		Ncb.ncb_lana_num = lenum.lana[i];

		[B]strcpy(Ncb.ncb_callname,"*               ");[/B]
		Ncb.ncb_buffer = (PUCHAR) &Adapter;
		Ncb.ncb_length = sizeof(Adapter);

		uRetCode = Netbios( &Ncb );

		if ( uRetCode == 0 )
		{
			client_macaddr[0] = Adapter.adapt.adapter_address[0];
			client_macaddr[1] = Adapter.adapt.adapter_address[1];
			client_macaddr[2] = Adapter.adapt.adapter_address[2];
			client_macaddr[3] = Adapter.adapt.adapter_address[3];
			client_macaddr[4] = Adapter.adapt.adapter_address[4];
			client_macaddr[5] = Adapter.adapt.adapter_address[5];
		}
	}
}

the part where it has that error is in bold.

can anyone help me?
thx
Daco

unsigned char and char are different types. ncb_callname should probably be of type char (I assume it's an array) rather than unsigned char.

ncb_callname is a array, forgot to mention that...
that function used to work great...

>that function used to work great...
So what you're trying to say is that your perfect code managed to rot. :icon_rolleyes:

>that function used to work great...
So what you're trying to say is that your perfect code managed to rot. :icon_rolleyes:

lol, not my function. well no clue what happend. thats why i posted. cause i have no clue what a uchar is and my googling didn't help either.

EDIT: in the original code it works but for some odd reason when adding all needed headers and code it doesn't work in mine...

The long and short of it is that strcpy expects a pointer to char or an array of char (which is converted to a pointer to char) as the first argument. A pointer to unsigned char doesn't count. If some other code works and yours doesn't, it means your code is doing something wrong.

If some other code works and yours doesn't, it means your code is doing something wrong.

which is odd as its a copy pasta lol

Is everything a copy paste? As in a verbatim copy?

Is everything a copy paste? As in a verbatim copy?

only the void
and yes, i included all needed things (and since i dont know what to do more then needed XD)

Well, if you don't believe me that strcpy doesn't accept a pointer to unsigned char, I guess you're screwed. ;)

Well, if you don't believe me that strcpy doesn't accept a pointer to unsigned char, I guess you're screwed. ;)

i believe you lol. youre probably more a pro then me XD

i am also facing same problem '

can any one help me to convert UCHR[] to char[]

Thanks in advance

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.