2013-12-19 30 views
0

我在閱讀文件的類中有以下代碼。當它在主文件中時它正常工作,但是當我把它放入另一個類的函數時開始顯示一個線程。這在調試時會自動顯示該代碼:用於字符串行的線程;同時閱讀文件

_LIBCPP_INLINE_VISIBILITY 
    void __zero() _NOEXCEPT 
      { 
      size_type (&__a)[__n_words] = __r_.first().__r.__words; 
      for (unsigned __i = 0; __i < __n_words; ++__i) 
       __a[__i] = 0; 
     } 

這是類:

#include <iostream> 
#include <fstream> // Stream class to both read and write from/to files 
#include <string> 
#include "CLevels.h" 

using namespace std; 

CLevels :: CLevels(){ 

} 

int CLevels :: loadFile(){ 
    std::string line; 
    ifstream myfile ("//Users//mariahsaliba//Documents//School//University//Second Year//Semester 1//CCE 2111 - Object Oriented Programming//Assignment_2013_CCE2110//Assignment//Levels.txt"); 
    if (myfile.is_open()) 
    { 
     while (getline (myfile,line)) 
     { 
      cout << line << '\n'; 
     } 
     myfile.close(); 
    } 

    else cout << "Unable to open file\n"; 
    return 0; 
} 

任何幫助嗎?

+1

我不明白你的意思是:「開始顯示一個線程」。你能解釋一下嗎? –

+0

你能顯示呼叫跟蹤嗎? – Nik

+0

您不需要將正斜槓加倍。 – molbdnilo

回答

1

許多標準的C++庫函數,即使在調試(未優化,-O0)模式內聯。當你通過在一個字符串對象的構造函數std::string或方法自己的C++代碼步進,以實現該代碼往往是內聯到您的權利功能。調試器看到該內聯從C++頭文件代碼在那裏。

LLDB試圖隱瞞你這個內聯,所以你看不到它的任何默認。但是這非常棘手,如果調試信息中的行表條目不完全正確,有時它看起來像是從標準庫中進入功能的中間。

只要點擊next/Step Over在這裏,我打賭你會回到你的實際方法的代碼。