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