Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting current mouse position Pin
Ryan Binns27-Jun-03 5:17
Ryan Binns27-Jun-03 5:17 
Questionhow to acquire system icon(like my computer) through programming? Pin
Anonymous27-Jun-03 4:31
Anonymous27-Jun-03 4:31 
AnswerRe: how to acquire system icon(like my computer) through programming? Pin
Ryan Binns27-Jun-03 4:43
Ryan Binns27-Jun-03 4:43 
GeneralRe: how to acquire system icon(like my computer) through programming? Pin
tiplip27-Jun-03 17:29
tiplip27-Jun-03 17:29 
GeneralRe: how to acquire system icon(like my computer) through programming? Pin
Ryan Binns27-Jun-03 17:37
Ryan Binns27-Jun-03 17:37 
GeneralRe: how to acquire system icon(like my computer) through programming? Pin
tiplip27-Jun-03 19:35
tiplip27-Jun-03 19:35 
GeneralRe: how to acquire system icon(like my computer) through programming? Pin
Ryan Binns28-Jun-03 0:12
Ryan Binns28-Jun-03 0:12 
Generaladding variables to a struct that were read in from a file Pin
johnstonsk27-Jun-03 4:05
johnstonsk27-Jun-03 4:05 
I have been using the getline() to read in lines from a file and delimiting on commas.
I need to set the items in a struct to these values that I read in.

When I get the data from the struct, I get garbage out.

Am I doing this wrong?

Some of the variables that are read in from the file are doubles and I have been using the atof() function to convert from string to double. But, the only way that the struct will allow me to put them in is if I use the c_str() function.

Thanks,
sj

<br />
<br />
<br />
struct TSimSignal<br />
	{<br />
		double Min[5];	  <br />
		double Max[5];	  <br />
		double Value[5]; <br />
		string Name[5];<br />
		string Unit[5];<br />
	};<br />
<br />
<br />

<br />
void setInitialValues(TSimSignal &s){<br />
<br />
		string name,unit,min,max,value;<br />
<br />
		fin.open("mockData.dat");	<br />
	<br />
		for(int i=0; i<sizeof(s.Name); i++){<br />
			getline(fin, name, ',');<br />
			if(name == "STOP")<br />
				break;<br />
			getline(fin, unit, ',');<br />
			getline(fin, min, ',');<br />
			getline(fin, max, ',');<br />
			getline(fin, value);<br />
			<br />
			<br />
			//s.Name[i] = name;<br />
			//s.Unit[i] = unit;<br />
			//s.Min[i]  = atof(min.c_str());<br />
		        //s.Max[i]  = atof(max.c_str());<br />
		        //s.Value[i]= atof(value.c_str());<br />
		}<br />
		<br />
	//dumpData(s);<br />
<br />
}<br />
<br />

GeneralRe: adding variables to a struct that were read in from a file Pin
Ryan Binns27-Jun-03 4:27
Ryan Binns27-Jun-03 4:27 
GeneralRe: adding variables to a struct that were read in from a file Pin
johnstonsk27-Jun-03 5:15
johnstonsk27-Jun-03 5:15 
GeneralRe: adding variables to a struct that were read in from a file Pin
Ryan Binns27-Jun-03 5:20
Ryan Binns27-Jun-03 5:20 
GeneralRe: adding variables to a struct that were read in from a file Pin
johnstonsk27-Jun-03 5:24
johnstonsk27-Jun-03 5:24 
GeneralRe: adding variables to a struct that were read in from a file Pin
Rage27-Jun-03 4:47
professionalRage27-Jun-03 4:47 
GeneralRe: adding variables to a struct that were read in from a file Pin
Ryan Binns27-Jun-03 4:59
Ryan Binns27-Jun-03 4:59 
GeneralRe: adding variables to a struct that were read in from a file Pin
John M. Drescher27-Jun-03 5:53
John M. Drescher27-Jun-03 5:53 
GeneralRe: adding variables to a struct that were read in from a file Pin
David Crow27-Jun-03 4:54
David Crow27-Jun-03 4:54 
GeneralRe: adding variables to a struct that were read in from a file Pin
johnstonsk27-Jun-03 5:18
johnstonsk27-Jun-03 5:18 
GeneralRe: adding variables to a struct that were read in from a file Pin
David Crow27-Jun-03 5:42
David Crow27-Jun-03 5:42 
GeneralRe: adding variables to a struct that were read in from a file Pin
Ryan Binns27-Jun-03 4:56
Ryan Binns27-Jun-03 4:56 
GeneralRe: adding variables to a struct that were read in from a file Pin
johnstonsk27-Jun-03 5:24
johnstonsk27-Jun-03 5:24 
GeneralRe: adding variables to a struct that were read in from a file Pin
Ryan Binns27-Jun-03 13:48
Ryan Binns27-Jun-03 13:48 
GeneralAbout SetIcon Pin
olinn27-Jun-03 3:56
olinn27-Jun-03 3:56 
GeneralRe: About SetIcon Pin
Rage27-Jun-03 4:25
professionalRage27-Jun-03 4:25 
Generalup and down arrows in a string. Pin
mcgahanfl27-Jun-03 3:29
mcgahanfl27-Jun-03 3:29 
GeneralRe: up and down arrows in a string. Pin
basementman27-Jun-03 3:43
basementman27-Jun-03 3:43 

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.