¿Qué encabezado debo incluir para memcpy y realloc?
Estoy portando un proyecto al iPhone y utiliza realloc
y memcpy
que no se encuentran. ¿Qué es el encabezado a incluir?
Es un proyecto que mezcla Objective C y C++ y estoy empezando a perderme.
Gracias de antemano por su ayuda!
28
2 answers
En C:
#include <string.h> // memcpy
#include <stdlib.h> //realloc
En C++, elimine el .h
y el prefijo con un c
. En C++, se colocarán en el espacio de nombres std
, pero también son globales.
40
Author: GManNickG,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-02-17 19:30:58
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-02-17 19:30:58
En C++ es más idiomático usar std::copy
que C memcpy
, aunque este último funciona igual de bien. Para obtener std::copy
, necesita #include <algorithm>
.
No hay un C++ directo equivalente a realloc
, sin embargo.
8
Author: Tyler McHenry,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-02-17 19:48:42
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-02-17 19:48:42