Click here to Skip to main content
16,006,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Strange struct definition Pin
George_George21-Sep-08 23:22
George_George21-Sep-08 23:22 
GeneralRe: Strange struct definition Pin
Matthew Faithfull21-Sep-08 23:37
Matthew Faithfull21-Sep-08 23:37 
GeneralRe: Strange struct definition Pin
George_George22-Sep-08 0:04
George_George22-Sep-08 0:04 
AnswerRe: Strange struct definition Pin
CPallini19-Sep-08 7:30
mveCPallini19-Sep-08 7:30 
GeneralRe: Strange struct definition Pin
George_George20-Sep-08 1:49
George_George20-Sep-08 1:49 
GeneralRe: Strange struct definition Pin
CPallini20-Sep-08 21:41
mveCPallini20-Sep-08 21:41 
GeneralRe: Strange struct definition Pin
George_George20-Sep-08 22:13
George_George20-Sep-08 22:13 
QuestionCString -> Float; Float -> CString Pin
Opa Knack19-Sep-08 3:55
Opa Knack19-Sep-08 3:55 
Hi,
I'm trying to read a file which contains lines like "0.14779E+02".
A made a function which return a vector\<float\>.
std::vector\<float\> readData() {
	std::vector<float> fResult;

	CString dataFile = _T("C:\\d2.txt");

	std::ifstream input(dataFile);

	if (!input) {
		MessageBox(0, L"input file cannot be opened", L"error", MB_OK);
		return fResult;
	}

	std::string c;
	float fLesen;
	
	while (!input.eof()) {
		std::getline(input, c);

		fLesen = atof((const char*)(LPCTSTR)c.c_str());
		fResult.push_back(fLesen);

	}
	input.close();

	return fResult;
}</float>


Every time I'm trying to print out the float with something like that:
std::vector\<float\> lines = readData();
	for (int i = 0; i < sizeof(lines); i++) {
		CString a;
		a.Format(_T("%f"), lines[i]);
		MessageBox((LPCTSTR)a, L"error", MB_OK);
	}

the variable a is emtpy.
What am I doing wrong?
Thanks in advance.
AnswerRe: CString -&gt; Float; Float -&gt; CString Pin
Mark Salsbery19-Sep-08 6:08
Mark Salsbery19-Sep-08 6:08 
GeneralRe: CString -&gt; Float; Float -&gt; CString Pin
Opa Knack22-Sep-08 2:21
Opa Knack22-Sep-08 2:21 
GeneralRe: CString -&gt; Float; Float -&gt; CString Pin
Mark Salsbery22-Sep-08 4:46
Mark Salsbery22-Sep-08 4:46 
QuestionHow to parse the string Pin
Member 443453619-Sep-08 2:44
Member 443453619-Sep-08 2:44 
AnswerRe: How to parse the string Pin
Malli_S19-Sep-08 3:00
Malli_S19-Sep-08 3:00 
GeneralRe: How to parse the string Pin
enhzflep19-Sep-08 3:08
enhzflep19-Sep-08 3:08 
GeneralRe: How to parse the string Pin
Malli_S19-Sep-08 3:12
Malli_S19-Sep-08 3:12 
AnswerRe: How to parse the string Pin
Malli_S19-Sep-08 3:00
Malli_S19-Sep-08 3:00 
AnswerRe: How to parse the string Pin
_AnsHUMAN_ 19-Sep-08 3:02
_AnsHUMAN_ 19-Sep-08 3:02 
AnswerRe: How to parse the string Pin
CPallini19-Sep-08 3:03
mveCPallini19-Sep-08 3:03 
AnswerRe: How to parse the string Pin
Sandeep Saini SRE21-Sep-08 20:31
Sandeep Saini SRE21-Sep-08 20:31 
Questionhow to change systemtime with c++ Pin
tarunkakkar199119-Sep-08 2:43
tarunkakkar199119-Sep-08 2:43 
QuestionRe: how to change systemtime with c++ Pin
CPallini19-Sep-08 2:54
mveCPallini19-Sep-08 2:54 
AnswerRe: how to change systemtime with c++ Pin
David Crow19-Sep-08 3:15
David Crow19-Sep-08 3:15 
QuestionHow to Disable Tree View Selection? Pin
Stuck At Zero19-Sep-08 2:42
Stuck At Zero19-Sep-08 2:42 
QuestionHow to Identify Which Control send the Message in mfc?? Pin
Vikas_12319-Sep-08 2:25
Vikas_12319-Sep-08 2:25 
AnswerRe: How to Identify Which Control send the Message in mfc?? Pin
CPallini19-Sep-08 2:41
mveCPallini19-Sep-08 2:41 

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.