2
在iOS中有沒有替代memcpy? 所以,據我所知,memcpy的不是「安全」,並建議替代方案是「memcpy_s」我可以在iOS上使用memcpy_s和ObjC嗎?
但是,代碼會由於編譯「爲架構的ARMv7未定義的符號:」問題,與memcpy_s更換的memcpy之後。
我該如何解決這個問題?如何設置項目設置?任何幫助將不勝感激。
從AsyncSocket.m一些代碼:
- (CFIndex)readIntoBuffer:(UInt8 *)buffer maxLength:(CFIndex)length
{
if([_partialReadBuffer length] > 0)
{
// Determine the maximum amount of data to read
CFIndex bytesToRead = MIN(length, [_partialReadBuffer length]);
// Copy the bytes from the buffer
memcpy(buffer, [_partialReadBuffer bytes], bytesToRead);
// Remove the copied bytes from the buffer
[_partialReadBuffer replaceBytesInRange:NSMakeRange(0, bytesToRead) withBytes:NULL length:0];
return bytesToRead;
}
else
{
return CFReadStreamRead(_theReadStream, buffer, length);
}
}
請在你使用memcpy的地方張貼一些代碼。 – sha
在這裏顯示一些代碼... – Mani
你可以嘗試使用'strcpy()'。 – user3007735