2017-07-28 31 views
1

我正在使用vtkX3DExporter導出字符串,但在調用GetOutputString()時出現異常。VTK 7.1.1:vtkX3DExporter異常

寫入文件成功,但寫入字符串不成功。

我使用VS2017,我的建築目標是x64 dll。另一個EXE進口此DLL和測試中,它是這樣的:

// ... codes ... 

exporter->SetFileName("D:\\TestFolder\\cccccccc.x3d"); 

exporter->Write(); // Writes to file successfully 

exporter->WriteToOutputStringOn(); // Turns On "WriteToOutputString" 

exporter->GetWriteToOutputString(); // Returns 1 

exporter->GetOutputStringLength(); // Returns 0 

exporter->GetOutputString(); // Exception here. 

我不能捕獲這個異常(我不知道爲什麼我用try和catch塊,但我的exe文件只是崩潰。),所以我不知道細節。

回答

0

好的,我找到了答案。在嘗試獲取輸出字符串之前,我應該調用exporter-> Update()。