Stack Exchange
intelliSense: expression must be a modifiable lvalue?
Can anyone tell me why I get this error with Visual C++ ? The break point are these lines.
BREAK POINTS ARE PathToTR
And PathToTR is:
static char pathToTR[] = "J:\\games\\Tabula Rasa\\Tabula Rasa 1.16.5.0";

Code pasted down below of ERROR(s)
    {
    case 2:
        pathToTR = (char*)malloc(strlen("."));
        strcpy(pathToTR, ".");

        nameOfMap = (char*)malloc(strlen(argv[1]));
        strcpy(nameOfMap, argv[1]);
    break;
    case 3:
        pathToTR = (char*)malloc(strlen(argv[1]));
        strcpy(pathToTR, argv[1]);

        nameOfMap = (char*)malloc(strlen(argv[2]));
        strcpy(nameOfMap, argv[2]);
    break;
    case 4:
        pathToTR = (char*)malloc(strlen(argv[1]));
        strcpy(pathToTR, argv[1]);

        nameOfMap = (char*)malloc(strlen(argv[2]));
        strcpy(nameOfMap, argv[2]);

        generateNewNavMesh = strcmp(argv[3], "false");
    break;
    default:
        printf("usage:\r\n\t%s <map name>\r\n\t%s <client folder> <map name>\r\n", argv[0], argv[0]);
        return 0;
}


Show the definition of pathToTR

static char pathToTR[] = "J:\games\Tabula Rasa\Tabula Rasa 1.16.5.0";

Do not add additional details in the comments, especially code. It gets lost in the clutter and noise, and it can't properly be formatted. Instead, [edit] your question and include the information there where it can be clearly noticed.

@KenWhite edit is in approve queue :)

All of your mallocs don't allocate enough space. Hint: don't use malloc in C++.

You did not show the definition of pathToTR however I suspect that you defined it as a character array. You have to define it as a pointer.
EDIT: As I suspected pathToTR is indeed is defined as an array. In this case statements like this
pathToTR = (char*)malloc(strlen("."));

have no any sense.
Either reserve more characters in this array that it could be appended with more data or each time allocate dynamically a big enough array and copy there pathToTR with new appended data.

How would i go threw out doing that? If you don't mind showing me

@user3627130 What are you trying to do with pathToTR in that swutch statement?

Trying to point it to my game directory. I was playing around with it. It seems to break those 3 "pathToTR" When i set the directory to my game here " static char pathToTR[] = "C:\Users\dillon\Tabula Rasa 1.16.5.0"; " If I just // The hole static char it has no errors.

@user3627130 I have not understood what you said. Read my updated post.

Heres a paste bin of it. http://pastebin.com/fHpLrNJs Line 250, 257 and 264 seem to be the errors if that makes it eaiser on you.
