memcpy

    -1热度

    1回答

    我试图解析任意索引周围的字符串。在我最简单的测试程序中,我可以想出我有一个输入字符串,我将输入读入,然后执行memcpy来解析字符串。 为了测试这个,我输入“this text”作为输入。 readInput是一个函数,我只需要调用getline(&输入,&大小,stinstin)并返回输入指针。 int main(){ char *input; input = readInp

    6热度

    3回答

    我在做C动态数组库,有点。请注意,我在空闲时间为了乐趣而努力,所以请不要推荐数百万个现有的库。 我开始实施分拣。该阵列是任意的元素的大小,定义为结构: typedef struct { //[PRIVATE] Pointer to array data void *array; //[READONLY] How many elements are in array

    0热度

    1回答

    我有2个坐标数组,我想将它们复制到一个数组中。我使用2 for循环和它的工作,但我想知道,如果我能做到没有他们,我不知道如何在这种情况下使用memcpy。这里是我的代码: int *join(int *first, int *second,int num, int size) { int *path= NULL; int i = 0 , j = 0; path = (int*) mall

    0热度

    1回答

    是否有任何C/C++ 11等 whcar_t* source,destiantion; int location; copy(source,destination,location,partOfSource); 功能即拷贝partOfSource WCHAR-S从源到目的地,从目的地的位置开始,源地址为0,没有终止L'\ 0'的目标字符串? 谢谢!

    0热度

    1回答

    在我的游戏中,我有一个地图std::map<Sound, sf::SoundBuffer> mySounds,我用它作为声音的资源保持者。 Sound是一个枚举,看起来像这样: enum class Sound { SOUND_ONE, SOUND_TWO, SOUND_THREE, NUMBER_OF_SOUNDS }; 现在,为了加载我目前使用sf

    0热度

    1回答

    下面的成员是代码, /****** list.h **********/ #include<stddef.h> #include<stdlib.h> #include<string.h> #include<stdio.h> /***************** Usage-start ************/ typedef enum{false, true}bool; type

    0热度

    1回答

    阵列I具有简单的结构: typedef struct{ double par[4]; }struct_type; 我还初始化函数为其,其中一个参数是一个4个元素的数组。如何正确使用memcpy initalize array in struct?这样的东西不适合我: struct_type* init_fcn(double array[4]){ struct _type* retVal

    0热度

    2回答

    我想用strlen打印字符串的长度。我知道它的长度是2个字节。但是,strlen返回零。有人能解释我为什么吗?请帮帮我。 #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> int main(void) { int16_t f = -105; unsigned c

    0热度

    2回答

    我有以下代码可以正确地将子字符串插入原始字符串的特定部分。我如何使用strcat()而不是memcpy()来做同样的事情? void insertString(char original[], int start, int length, char toInsert[]){ size_t insertlen = strlen(toInsert); size_t origlen

    -2热度

    2回答

    我被要求实现我自己的memcopy版本。这是我从互联网上找到的。令我困惑的是,我们有两个void *指针,为什么然后我们将它们转换成char*? 这是否正确? // A C implementation of memcpy() #include<stdio.h> #include<string.h> void myMemCpy(void *dest, void *src, siz