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

C / C++ / MFC

 
AnswerRe: Are there any articles/tutorials on making Help files in C++? Pin
Taka Muraoka26-Jun-03 14:25
Taka Muraoka26-Jun-03 14:25 
AnswerRe: Are there any articles/tutorials on making Help files in C++? Pin
Andrew Walker26-Jun-03 15:22
Andrew Walker26-Jun-03 15:22 
GeneralRe: Are there any articles/tutorials on making Help files in C++? Pin
nssone27-Jun-03 3:50
nssone27-Jun-03 3:50 
GeneralForward declaration of template Pin
Stan the man26-Jun-03 10:26
Stan the man26-Jun-03 10:26 
GeneralRe: Forward declaration of template Pin
Dave Bryant26-Jun-03 10:36
Dave Bryant26-Jun-03 10:36 
GeneralCOM Event Pin
act_x26-Jun-03 9:00
act_x26-Jun-03 9:00 
QuestionCan SendInput send extended ASCII characters? Pin
Dr. Ferd DeChezno26-Jun-03 8:58
Dr. Ferd DeChezno26-Jun-03 8:58 
Generalfile reading and converting the strings to doubles Pin
johnstonsk26-Jun-03 8:46
johnstonsk26-Jun-03 8:46 
A quick plug, Thanks to the guys that helped with the random double generatorSmile | :)

I am reading in a file and parsing the data.

right now I am using the getline() function.
I am able to parse everything in the file with no problems.

Once I have the data I need to add it to a struct

There are 5 values on each line.
string,string,string,double,double

When I use the getline() function I everything is a string.

How can I convert the last 2 strings to doubles?

Is there a function that will allow me to get chars instead of strings?


Thanks,
sjSmile | :)

here is my function is case I didn't explain well enough:

<br />
struct TSimSignal<br />
	{<br />
		double Min[5];	  <br />
		double Max[5];	  <br />
		double Value[5]; <br />
		char Name[5];<br />
		char Unit[5];<br />
	};<br />
<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 />
	<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 />
			s.Name[i]= name;<br />
			s.Unit[i]= unit;<br />
			s.Min[i]=  (double)min;<br />
			s.Max[i]=  (double)max;<br />
			s.Value[i]=(double)value;<br />
<br />
			cout << endl << name<<" "<<unit<<" "<<min<<" "<<max<<" "<< value << "\n";<br />
		<br />
		}					<br />
<br />
}<br />
<br />
<br />

GeneralRe: file reading and converting the strings to doubles Pin
Peter Weyzen26-Jun-03 8:51
Peter Weyzen26-Jun-03 8:51 
General.exe program won't stay open Pin
DaveE9th26-Jun-03 8:45
DaveE9th26-Jun-03 8:45 
GeneralRe: .exe program won't stay open Pin
Peter Weyzen26-Jun-03 8:49
Peter Weyzen26-Jun-03 8:49 
GeneralRe: .exe program won't stay open Pin
DaveE9th26-Jun-03 8:58
DaveE9th26-Jun-03 8:58 
GeneralRe: .exe program won't stay open Pin
Peter Weyzen26-Jun-03 9:01
Peter Weyzen26-Jun-03 9:01 
GeneralRe: .exe program won't stay open Pin
yashraj121526-Jun-03 15:21
yashraj121526-Jun-03 15:21 
GeneralRe: .exe program won't stay open Pin
Scozturk26-Jun-03 20:50
professionalScozturk26-Jun-03 20:50 
GeneralRe: .exe program won't stay open Pin
pf727-Jun-03 3:54
pf727-Jun-03 3:54 
QuestionWhat is UNICODE? Pin
DaveE9th26-Jun-03 8:38
DaveE9th26-Jun-03 8:38 
AnswerRe: What is UNICODE? Pin
Peter Weyzen26-Jun-03 8:45
Peter Weyzen26-Jun-03 8:45 
GeneralRe: What is UNICODE? Pin
DaveE9th26-Jun-03 8:47
DaveE9th26-Jun-03 8:47 
GeneralRe: What is UNICODE? Pin
Peter Weyzen26-Jun-03 8:50
Peter Weyzen26-Jun-03 8:50 
GeneralRe: What is UNICODE? Pin
DaveE9th26-Jun-03 8:59
DaveE9th26-Jun-03 8:59 
GeneralRe: What is UNICODE? Pin
Peter Weyzen26-Jun-03 9:08
Peter Weyzen26-Jun-03 9:08 
GeneralRe: What is UNICODE? Pin
DaveE9th26-Jun-03 9:11
DaveE9th26-Jun-03 9:11 
GeneralRe: What is UNICODE? Pin
Peter Weyzen26-Jun-03 11:04
Peter Weyzen26-Jun-03 11:04 
GeneralClickety Pin
Jon Sagara26-Jun-03 15:13
Jon Sagara26-Jun-03 15:13 

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.