- Jan 15, 2000
- 7,052
- 0
- 0
Ok right now I'm building a string character by character by reading in one byte of memory at a time until I hit a null character. There is a maximum length for the string (50), and the first thing I do is to null out the entire char array so that every spot in the array is now NULL. I then read in character by character from memory into this array and stop when i read in a null character.
Ok, now my problem is I need to be able to do this many times over, and I need to be able to save the string I created into memory. The project I'm working on needs to extract each string from argv[] in memory, add a separate filename as argv[0] and append the rest of argv afterwards. So basically I'm pulling out argv[] and the filename from memory and creating a new array with argv[0] being the filename, and the rest argv[1...argc] being the argv strings themselves. I need to be able to save off each string, and we know how many strings there are because argc tells us how many there are. How can I do this so that each string I pull out is saved into memory so that I can make a new array containing all of these strings?
Ok, now my problem is I need to be able to do this many times over, and I need to be able to save the string I created into memory. The project I'm working on needs to extract each string from argv[] in memory, add a separate filename as argv[0] and append the rest of argv afterwards. So basically I'm pulling out argv[] and the filename from memory and creating a new array with argv[0] being the filename, and the rest argv[1...argc] being the argv strings themselves. I need to be able to save off each string, and we know how many strings there are because argc tells us how many there are. How can I do this so that each string I pull out is saved into memory so that I can make a new array containing all of these strings?