Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

too few arguments to function ‘memcpy’ [closed]

Tags:

c++

c

memory

what I understand is that memcpy must have 3 arguments:

void * memcpy ( void * destination, const void * source, size_t num );

so I am trying this code:

//char *tmpPtr is a pointer that points to some data
char frameBuffer[921600]; //destination starting a given index
int bufferIndex;//the given index
memccpy(frameBuffer+bufferIndex,tmpPtr,Data.size()-1);

but I am getting this error:

error: too few arguments to function `void * memccpy (void *, const void *, int, size_t)

like image 392
Ahmed Kato Avatar asked Jan 08 '13 22:01

Ahmed Kato


People also ask

What can I use instead of memcpy?

memmove() is similar to memcpy() as it also copies data from a source to destination.

What does too few arguments to function mean?

At times, you may have noticed an error “You've Entered Too Few Arguments For This Function” while working with Excel. It mainly happens when you don't fill up the required spaces for the arguments to perform a function in an Excel formula.

Does memcpy return anything?

The memcpy() function shall return s1; no return value is reserved to indicate an error.

What is memcpy in C?

memcpy() is used to copy a block of memory from a location to another. It is declared in string.h. // Copies "numBytes" bytes from address "from" to address "to" void * memcpy(void *to, const void *from, size_t numBytes); Below is a sample C program to show working of memcpy().


1 Answers

Typo:

memccpy
   ^^

You called the wrong function.

memccpy also takes a character (as an int argument) upon encountering which the copy shall be stopped.

like image 101
Daniel Fischer Avatar answered Sep 24 '22 08:09

Daniel Fischer