I have succeded with a code that takes the First and Second value out of: 12/04/2007,2111,35.23,35.23,35.20,35.22,15600,35.22
wich is: 12/04/2007 and 2111
The second step after this is to tell for the code below: If Time == 2111 (wich it is)
it will write the Time to the file. I have tried to do an approch but it doesn´t work.
Perheps I have missed something here.
Code:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
int main ()
{
std::string Date;
std::string Time;
ofstream Test;
Test.open ("file2.txt");
ifstream myfile ("file1.txt");
ifstream file0 ("file0.txt");
getline(myfile, Date, ',');// myfile >> tal;
getline(myfile, Time, ',');// myfile >> tal;
If (Time == 2111) // This is what I am trying to do here: If Time is 2111 wich it is in this case.
{
Test << Time <<"\n"; }
return 0;
}