error expression must be a modifiable value

I am trying to read a value from the set variables,
but for some reason, I cannot seem to change transgerfolder parameter after
i found the path.

Error (active) E0137 expression must be a modifiable value

what am I doing wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 if (*p != ' ')
  {
   p[strlen(p) - 1] = 0;
   strcpy(transferFolder, p);

    if (_access(transferFolder, 0) != 0)
	{
	char* POnlinee;// [256] ;
	POnlinee = getenv(transferFolder);
	strcpy(PTempfolder, "Current User prop set Folder = ");
	strcat(PTempfolder, POnlinee);
	TransferFolder = PTempfolder; // <-- Error on this line
        WriteLog(transferFolder);
	
        if (_access(transferFolder, 0) != 0)
	   {
		transferFolderExists = false;
		WriteLog("TRANSFERFOLDER does not exist");
		}
	}
  else
   transferFolderExists = true;
   WriteLog(transferFolder);
   Break;
}
need to see transferfoler variable creation.
that one is created at the beginning of the source.
Well,
TransferFolder is not the same as transferFolder - case matters.

And you can't write the = operation for c-strings (if that is what they are).
So I have this now.

my env. has a folder tmp as c:\test\
the transferfolder is a parameter that is stored in a file. that contains the set env.
I can't seem to get the set env into the transferfolder variable.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
char transferFolder[] = "transferFolder";


if (_access(transferFolder, 0) != 0)
{
 char* POnlinee;
 POnlinee = getenv(transferFolder);

 strcpy(PTempfolder, "Current User prop set Folder = ");
 strcat(PTempfolder, POnlinee);
 *transferFolder = *PTempfolder;
 WriteLog(transferFolder);
 if (_access(transferFolder, 0) != 0)
  {
   transferFolderExists = false;
   WriteLog("TRANSFERFOLDER does not exist");
  }
}
  else
   transferFolderExists = true;
   WriteLog(transferFolder);
   break;
ok got it figured out.. I needed to use strcopy (transferfolder,*PTempfolder)


Still new to all of this.

Now need to figure out how to change the string from

c:\test\1\234
to
c:\\test\\1\\234

you are making it hard for yourself using C-style strings. are you allowed to use c++ strings and tools?

if not, you write your own copy is the easy way...
for all the letters, copy to a new string, but if its a \, add it in a second time.
Topic archived. No new replies allowed.