Hi i am trying to figure out how to copy only part of a line being read from a text file. I want to copy a line from a file called fileLine to a variable called line. The problem is, is that i only want to copy starting at index 10 in fileLine but memcpy dislikes that. How can i change this to make memcpy happy?
int stringLength = 0;
stringLength = strlen(fileLine);
memcpy(line, fileLine[10], stringLength); //this is where things go wrong.
memcpy(line, &fileLine[10], stringLength-10);strcpy()so you don't risk running off the end of the string:strcpy(line, &fileLine[10]);- or usestringLength = strlen(fileLine) - 10;if you insist onmemcpy().