c - Error "'strcpy' makes pointer from integer without a cast" -


struct phaseshiftpin {     int _psppin_index;      //psp = phase shift pin     int _pspvalue;     char _pspname[512]; }; struct phaseshiftpin *_phaseshiftpin[500000]; int p3int = 0; strcpy ( _phaseshiftpin[i]->_pspvalue, p3int ); 

the above code part of full code. when compiled full program happened error strcpy' makes pointer integer without cast @ line

strcpy ( _phaseshiftpin[i]->_pspvalue, p3int ); 

i have referred post @ here makes pointer integer without cast strcpy after tried use strncpy , follow method showed in post still fail in compilation.hope can guide me problem.thanks.

if @ definition of strcpy can see

char *strcpy(char *dest, const char *src); 

but _phaseshiftpin[i]->_pspvalue integer , p3int also.

you can use memcpy

void *memcpy(void *dest, const void *src, size_t n);  strcpy ( &(_phaseshiftpin[i]->_pspvalue), &(p3int), sizeof(p3int) ); 

or said in comment

_phaseshiftpin[i]->_pspvalue =  p3int; 

if try copy p3int _phaseshiftpin[i]->_pspvalue


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -