ilmenator Posted January 14, 2011 Report Share Posted January 14, 2011 Hi, I have this typedef struct prog_list_tag { u16 index; u16 bank_number; char file_name[4]; char bank_name[16]; } prog_bank_list_t; // each entry represents one available PROG bank on SD card prog_bank_list_t prog_bank_list[100]; and this: extern char current_prog_bank_name[16]; How can I copy the bank_name in the struct (e.g. the one in the second entry of prog_bank_list) into the array current_prog_bank_name? I think I got a mental block right now... Quote Link to comment Share on other sites More sharing options...
TK. Posted January 14, 2011 Report Share Posted January 14, 2011 #include <string.h> ... int bank = 0; memcpy((char *)current_prog_bank_name, (char *)prog_bank_list[bank].bank_name, 16); [/code] Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
ilmenator Posted January 14, 2011 Author Report Share Posted January 14, 2011 I definitely had a mental block! Thanks!! Quote Link to comment Share on other sites More sharing options...
Phatline Posted January 2, 2015 Report Share Posted January 2, 2015 I also want to "memcpy" C, 8Bit Core, 18F4685: #include <string.h> int MtxLoad0[8]; //Destination Array int Mtx0Part0[8]; //Source Array if(pin == 0 && pin_value == 0){memcpy(MtxLoad0, Mtx0Part0, 8);} give me this error: error: missing definition for symbol "_memcpy", required by "_output/main.o" where do i have to define "memcpy"? Quote Link to comment Share on other sites More sharing options...
TK. Posted January 2, 2015 Report Share Posted January 2, 2015 memcpy() isn't available, copy it with a for loop... Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Phatline Posted January 2, 2015 Report Share Posted January 2, 2015 ok thankz i made this: #include <string.h> int MtxLoad0[8]; //Destination Array int Mtx0Part0[8]; //Source Array int LoroCount; //counter 4 "for" loop -LoadRoll... if(pin == 0 && pin_value == 0) {for(LoRoCount=0; LoRoCount<8; LoRoCount++) {MtxLoad0[LoRoCount]=Mtx0Part0[LoRoCount];}} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.