Login Page - Create Account

Support Board


Date/Time: Tue, 07 Jan 2025 20:28:42 +0000



Post From: problem : I do not know how do you retrieve the line in a text file.

[2016-06-15 10:18:23]
User210074 - Posts: 63
I do not know how do you retrieve the line in a text file.
I want to recover 1 in this txt file.


#include <iostream>
#include <string>
#include <fstream>
#include "sierrachart.h"
#include <stdio.h>
#include <time.h>
using namespace std;
SCDLLName("Test");
SCSFExport scsf_DTNS(SCStudyGraphRef sc) {
if(sc.SetDefaults){
sc.GraphName="Test";
sc.StudyDescription="Test";
sc.FreeDLL = 1;
   sc.GraphRegion = 0;
}//Fin de la fonction Defaut//
   ifstream Files("Z:\\Sierra_Chart\\Data\\Val.txt", ios::in);//Z:\\SC_Graphique_rithmic\\Data\\Val.txt"
   if(Files){
       //sc.AddMessageToLog("File Open.", 1);
     string Lines;
       while ( getline(Files, Lines) ) {
// .....
       }
Files.close();
       return;
   }//Right
   else{
sc.AddMessageToLog("File Not Open.", 1);
     return;
   }//Wrong
}//Fin de fonction//

In Val.txt

1 // Line 1

How can i retrieved the line in the WHILE ?
I don't Know !