User (Legacy) Posted October 27, 2003 Report Share Posted October 27, 2003 Hello, I'm trying to read data from a textfile, but calling GetExternalData crashes. Whats going wrong? Example: OpenDataEx( COD_VALUES, 3, 3 ); CloseData( COD_VALUES ); CString FileName = "Path\\test.txt"; BSTR BFileName = FileName.AllocSysString(); VARIANT Val; Val.vt = VT_BSTR; Val.bstrVal = BFileName; ChartP->GetExternalData( Val ); ::SysFreeString( BFileName ); Data File test.txt: 12 14 17 15 5 2 9 20 12 the values are separeted with tabs. I also tried csv files, the values are separated with commas, but the effect was the same. Thanks for your help Mike Link to comment Share on other sites More sharing options...
Software FX Posted October 27, 2003 Report Share Posted October 27, 2003 GetExternalData doesn't receive a file name. Please check the docs, it receives a Data Provider object. If you want to read for a Text File you need to do: CString ProviderName = "CfxData.File"; VARIANT Provider; Provider.vt = VT_BSTR; Provider.bstrVal = ProviderName.AllocSysString(); CString FileName = "d:\\temp\\data.txt"; VARIANT Val; Val.vt = VT_BSTR; Val.bstrVal = FileName.AllocSysString(); m_pChartFX->GetExternalData( Provider, Val ); -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.