Почему моя строка теряет свое значение?

По какой-то причине значение моей переменной toCheck стирается, и я понятия не имею, почему. Какие-либо предложения?

bool
check(string toCheck){
    printf("toCheck: %s\n", toCheck.c_str());
    ifstream list;
    list.open("list.txt");
    string temp;
    while(list){
        getline(list,temp);
        printf("toCheck: '%s' temp: '%s'\n",toCheck.c_str(), temp.c_str());
        if(temp == toCheck){
            printf("Username exists\n");
            return false;
        }
    }
    printf("returning true\n");
    return true;
}

Вот что проходит :TestTrevor

А вот результат:

toCheck: TestTrevor  
toCheck: '' temp: 'Trevor'  
toCheck: '' temp: ''  

Username exists
6
задан Madara Uchiha 25 September 2012 в 16:22
поделиться