Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRenaming a project Pin
Trollslayer5-Apr-04 2:59
mentorTrollslayer5-Apr-04 2:59 
GeneralRe: Renaming a project Pin
Andrew Walker5-Apr-04 3:17
Andrew Walker5-Apr-04 3:17 
GeneralRe: Renaming a project(EDITED) Pin
John M. Drescher5-Apr-04 5:41
John M. Drescher5-Apr-04 5:41 
GeneralRe: Renaming a project(EDITED BY ME) Pin
Trollslayer5-Apr-04 6:00
mentorTrollslayer5-Apr-04 6:00 
GeneralRe: Renaming a project(EDITED BY ME) Pin
John M. Drescher5-Apr-04 6:14
John M. Drescher5-Apr-04 6:14 
GeneralIPersistStorage::Load() for Embeded object of Word Creates .doc file in Temp Pin
anshumanshinde5-Apr-04 2:47
anshumanshinde5-Apr-04 2:47 
GeneralRe: IPersistStorage::Load() for Embeded object of Word Creates .doc file in Temp Pin
Mike Dimmick5-Apr-04 6:37
Mike Dimmick5-Apr-04 6:37 
Generalread a certain line from a text file Pin
dairiseky5-Apr-04 2:44
dairiseky5-Apr-04 2:44 
I have a file that contains the following datas:
-2363824.109 (x position)
4870666.240 (y position)
2.18 (speed)
I want to read from this file either just the x position, either the y position, either the speed.
I did the following:
int main(int argc, char *argv[]){<br />
  <br />
	ifstream GPSFile; //mode lecture<br />
	GPSFile.open("C:\\My Files\\GPSFile\\GPSFile.txt", ios::in);//ouvre le fichier <br />
	//c'est le fichier où on écrit les datas du gps<br />
	double CataCoordX, CataCoordY;<br />
	double gpsx=0, gpsy=0;<br />
	while (!GPSFile.eof()){//tant que le fichier reste ouvert<br />
		if (GPSFile.rdstate() == ios::failbit){cout<<"ERROR, \n";}<br />
		///GPSFile.seekg(ios::beg); //go to the beginning of the file<br />
		GPSFile >> gpsx;//on lit<br />
		GPSFile >> gpsy;//on lit<br />
		CataCoordX=gpsx;//la première val devient les coord sur x<br />
	    CataCoordY=gpsy;//la deuxième val devient les coord sur y<br />
	}//endwhile<br />
	cout << CataCoordX <<endl;<br />
	cout << CataCoordY <<endl;<br />
	GPSFile.close();<br />
	return 0;<br />
}

This will print :
2.18
4.87067e+006
But me i want to print the first and the secon value. How to do this?

THX
GeneralRe: read a certain line from a text file Pin
avenger_sb255-Apr-04 3:42
avenger_sb255-Apr-04 3:42 
GeneralRe: read a certain line from a text file Pin
dairiseky5-Apr-04 4:01
dairiseky5-Apr-04 4:01 
GeneralRe: read a certain line from a text file Pin
avenger_sb255-Apr-04 4:46
avenger_sb255-Apr-04 4:46 
GeneralRe: read a certain line from a text file Pin
dairiseky5-Apr-04 5:18
dairiseky5-Apr-04 5:18 
GeneralRe: read a certain line from a text file Pin
avenger_sb255-Apr-04 7:10
avenger_sb255-Apr-04 7:10 
GeneralRe: read a certain line from a text file Pin
dairiseky5-Apr-04 8:02
dairiseky5-Apr-04 8:02 
GeneralRe: read a certain line from a text file Pin
avenger_sb255-Apr-04 8:51
avenger_sb255-Apr-04 8:51 
GeneralRe: read a certain line from a text file Pin
David Crow5-Apr-04 4:50
David Crow5-Apr-04 4:50 
GeneralRe: read a certain line from a text file Pin
dairiseky5-Apr-04 5:22
dairiseky5-Apr-04 5:22 
GeneralRe: read a certain line from a text file Pin
David Crow5-Apr-04 7:33
David Crow5-Apr-04 7:33 
GeneralRe: read a certain line from a text file Pin
Anonymous5-Apr-04 7:44
Anonymous5-Apr-04 7:44 
GeneralRe: read a certain line from a text file Pin
dairiseky5-Apr-04 7:48
dairiseky5-Apr-04 7:48 
GeneralRe: read a certain line from a text file Pin
dairiseky6-Apr-04 2:46
dairiseky6-Apr-04 2:46 
GeneralRe: read a certain line from a text file Pin
David Crow6-Apr-04 3:24
David Crow6-Apr-04 3:24 
GeneralDialog related question Pin
Imtiaz Murtaza5-Apr-04 2:16
Imtiaz Murtaza5-Apr-04 2:16 
GeneralRe: Dialog related question Pin
avenger_sb255-Apr-04 2:48
avenger_sb255-Apr-04 2:48 
GeneralRe: Dialog related question Pin
David Crow5-Apr-04 4:52
David Crow5-Apr-04 4:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.