dearphael
April 21st, 1999, 10:12 AM
Hi,
I defined an char array of 20 elements
char temp[20];
the problem is, i am copying the contents of another CString to this temp and the CString length is not fixed. during my program, everytime the user selects to rename the temp array, the CString will be copied to the temp array. however, the previous contents of the array are still there.
for example, let's say the first time, CString is myfilename.exe
so temp will be renamed as myfilename.exe
then the second time, if CString is myfile.exe
then temp should also be myfile.exe. but because i do not know how to terminate a char array, the temp is still with the previous length, so now temp becomes myfile.exe.exe
How do i put it such that after copying CString to temp, i can put an end of string in temp so that the previous contents are ignored?
please help
I defined an char array of 20 elements
char temp[20];
the problem is, i am copying the contents of another CString to this temp and the CString length is not fixed. during my program, everytime the user selects to rename the temp array, the CString will be copied to the temp array. however, the previous contents of the array are still there.
for example, let's say the first time, CString is myfilename.exe
so temp will be renamed as myfilename.exe
then the second time, if CString is myfile.exe
then temp should also be myfile.exe. but because i do not know how to terminate a char array, the temp is still with the previous length, so now temp becomes myfile.exe.exe
How do i put it such that after copying CString to temp, i can put an end of string in temp so that the previous contents are ignored?
please help