Append/concat strings and char arrays


I have a char array(400MB-1GB) and need to have another string(300 chars) appended to the beginning of it. I could append "the char array" to the smaller string, and that would give me the right order, but it's probably better to copy 300 chars to 400MB than the other way around.

What can I do?


Best regards
Volang

Last edited on
What do you plan to do with the combined string once you're done?

Where is "char array(400MB-1GB)" coming from?

Is "another string(300 chars)" always 300, approximately 300, maximum 300?

I might consider reading the 100's of GB starting at say a 1K offset in the array allocated.
Prepending a shorter string then is just some pointer arithmetic and keeping track of where the real memory starts and where the real string starts.
Why not keep the 300 bytes where it is? You really shouldn't need to maintain a huge contiguous block of memory like that.
Topic archived. No new replies allowed.