thats where im getting things wrong wen it comes to working my way through the loop. Im not sure im implimenting my loop correctly as it keeps infinatley running. I have decided to get the overall string size then erase each part from the loop size as i find it but im thinking this is a rubbish way of doing it.
Code:
int lengthOfString = str.length(); //getting the length of big string
string str2 ("\\DEVICE"); // delimiter to cut up string
size_t found;
size_t found2;
string path = ""; // string to recieve each slic of string
while (lengthOfString > 1) //looping through length of string until empty
{
found=str.find(str2); // finding first instance
if (found!=string::npos)
found2=str.find("\\DEVICE",found+1); //finding second instance
if (found!=string::npos)
path = str.substr (found,found2); //putting in string
str.erase (0,found2); // erasing these characters from overall string
lengthOfString = lengthOfString - found2; //minusing length of string from loop
}