For the life of me, I cannot concatenate two(/three) strings. These are some codes I have tried:
dir := 'C:\Users\' + Username + '\Downloads\done.txt'; //"Username" is the computer's current username.
//another example vvv
dir := 'C:\Users\' + Username;
dir := dir + '\Downloads\done.txt';
//last example vvv
dir := Concat('C:\Users\', Username, '\Downloads\done.txt');
All of the examples always return the same result:
C:\Users\-username-
Never:
C:\Users\-username-\Downloads\done.txt
What am I doing wrong here?
My guess is that your
Usernamevariable contains #0 at its end and you’re outputing that variable to a certain Windows API function. For instance the following code will result to this misbehavior:My suggestion is to check the value of your
Usernamevariable and remove the extra #0 at the end if there’s some.