The aim is to create a gdb function that changes current path to the upper level i.e
C:\Windows
to C:\
I tried to strip away characters while the buffer array != '\'
Here is what I tried:
void gdbCommand(){
char buffer[MAXCHAR];
strncpy(buffer,path,sizeof(buffer));
char result[MAXCHAR];
for(int i = 0; i < MAXCHAR;i++){
while(buffer[i] != '\''/*is this right?*/){
result[i] +=buffer[i];
}
}
cout << result; // testing if it worked
}
Once this function is called in the main then the whole program stops. I think I'm on the wrong track or is there an easier method? Googled too many times. Could not find anything relevant. So had to come here for help/ideas.