Support Board
Date/Time: Thu, 28 Nov 2024 00:43:55 +0000
Post From: Read & parse CSV
[2020-01-06 14:16:14] |
User462086 - Posts: 196 |
FWIW, this seems to be working as expected. Any comments/improvements welcome. #include "sierrachart.h" SCDLLName("Test_ReadFile") SCSFExport scsf_Test_ReadFile(SCStudyInterfaceRef sc){ SCString DebugMessage; // int/bool %d; float %f, %g, %e; string %s // DebugMessage.Format("caption : %d",var); // sc.AddMessageToLog(DebugMessage, 0); SCInputRef FullPath = sc.Input[0]; if (sc.SetDefaults){ sc.GraphName = "Test_ReadFile"; sc.AutoLoop = 0; FullPath.Name = "Full Path to Text File"; FullPath.SetPathAndFileName(""); return; } std::ifstream input(FullPath.GetPathAndFileName()); for( std::string line; getline(input,line); ){ DebugMessage.Format( "line : %s", line.c_str() ); sc.AddMessageToLog( DebugMessage, 0 ); } } |