I have a char array with a size of 17. I need to copy each block of 4 characters from the array into 4 separate char arrays. I'm not exactly how to go about this.
DLightman 0 Newbie Poster
Recommended Answers
Jump to Postyou can use strncpy()
strncpy(a2, strings+4, 4);
or you can just write a function that would copy 4 bytes from the starting address.
The latter is better, I think
All 4 Replies
Prabakar 77 Posting Whiz
DLightman 0 Newbie Poster
csurfer 422 Posting Pro
DLightman 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.