i have this run time error "access violation writing location " with strcpy function
Here part of my code:
else if (strcmp(sentenceRecv, "405002") == 0){
/*winVersion[SIZE] = (char*)malloc(sizeof(tempString));*/
system("ver >> text.txt");
FILE *pfile = fopen("text.txt", "rt+");
if (pfile == NULL)
{
printf("Couldn't open file\n");
}
fread(tempString, sizeof(char), SIZE - 1, pfile);
fclose(pfile);
pfile = fopen("text.txt", "w");
if (pfile == NULL)
{
printf("Couldn't open file\n");
}
fputc((int)' ', pfile);
fclose(pfile);
/* winVersion[SIZE] = strdup(tempString);*/
strcpy(winVersion, tempString);
send(ClientSocket, winVersion, sizeof(winVersion), 0);
menuCheck = 1;
}
The error is in this line:strcpy(winVersion, tempString);
and in the first lines i write:
char winVersion[SIZE];
char tempString[SIZE];