Hello!!
I thought I would try and post a problem I have been unable to solve as of yet, though I imagine is easy for experts ;oP
I am trying to play around with the mouse functions of Windows, attempting to create a sort of mouse free environment that uses x,y inputs from an eye tracker, (well not yet, at the moments it is a long list of x,y coordinates in a .csv file)
I am used to programming a bit in java, however c++ seemed more appropriate for this task, so I am persevering. Anyway, I am having trouble in being able to separate the values in the csv file, there are only 2 columns, x and y respectively, and what I am after is to firstly
a) read in the file
b) read the first line
c) Distinguish the two values separated by a comma (x and y)
d) assign to two integer variables posx and posy
e) go to the next line and repeat c) to d)
From here, I will be using the x,y coordinates to pass to the mouse movement functions I found using the API. I know this is a simple task (probably) as I am fairly confident I could write the file parsing in Java fairly easy, however with C++ being new to me I am strugging a bit,
Any help would be appreciated in extracting the information from the csv file and passing to the variables,
Kind Regards,
David
PS, for your info, I have been messing with c++ and the csv file and managed to get it to extract all the info and display it, not amazing I know, but it may be a bit of a base for those who can help
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string line;
ifstream eyetrack ("eyetrack1test.csv");
if (eyetrack.is_open())
{
while (! eyetrack.eof() )
{
getline (eyetrack,line);
cout << line << endl;
}
eyetrack.close();
}
else cout << "Unable to open file";
return 0;
}