Click here to Skip to main content
15,916,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what function will convert a char to its number value Pin
John M. Drescher11-Jul-03 7:56
John M. Drescher11-Jul-03 7:56 
GeneralRe: what function will convert a char to its number value Pin
johnstonsk11-Jul-03 7:59
johnstonsk11-Jul-03 7:59 
GeneralRe: what function will convert a char to its number value Pin
John M. Drescher11-Jul-03 8:02
John M. Drescher11-Jul-03 8:02 
AnswerRe: what function will convert a char to its number value Pin
John R. Shaw11-Jul-03 9:21
John R. Shaw11-Jul-03 9:21 
AnswerRe: what function will convert a char to its number value Pin
Terry O'Nolley11-Jul-03 9:27
Terry O'Nolley11-Jul-03 9:27 
GeneralRe: Whoops Pin
John R. Shaw11-Jul-03 10:15
John R. Shaw11-Jul-03 10:15 
GeneralRe: Whoops Pin
Terry O'Nolley12-Jul-03 3:58
Terry O'Nolley12-Jul-03 3:58 
GeneralRe: what function will convert a char to its number value Pin
johnstonsk11-Jul-03 10:26
johnstonsk11-Jul-03 10:26 
Believe me I don't have to do this for a school project.

I have created a tool that display flight simulator data in real time.

Long story short:
(this is just another feature of the program)
The flight simulator writes to a file and I use the getline() function to get the names of signals that the sim wrote and put them in TSimHeader_arr[0].Name[i] which is an array in a struct.

anyways I think the function (char)strdup(name.c_str())isn't putting them in the char array correctly.
Because when I read them bach out they are strange characters.

I don't know how to do this.

Does anyone???

steven
void setInitialValues(){<br />
		sSignal.SimWriteFlag=1; <br />
		sSignal.DisplayReadFlag=0;		<br />
		sHeader.SimStatus=setSimStatus();<br />
	<br />
		string name,unit,min,max,value;<br />
<br />
		for(int i=0; i<sizeof(sHeader.Name); i++){<br />
			getline(fin, name, ',');<br />
			<br />
			if(name == "STOP")<br />
				break;<br />
			getline(fin, unit, ',');<br />
			getline(fin, min, ',');<br />
			getline(fin, max, ',');<br />
			getline(fin, value);<br />
			<br />
			TSimHeader_arr[0].Name[i]  = (char)strdup(name.c_str());						                <br />
                        TSimHeader_arr[0].Unit[i]  = (char)strdup(unit.c_str());		<br />
			TSimHeader_arr[0].Min[i]   =  atof(min.c_str());<br />
		        TSimHeader_arr[0].Max[i]   =  atof(max.c_str());<br />
		        TSimSignal_arr[0].Value[i] =  atof(value.c_str());<br />
			<br />
			//	printf("%s",TSimHeader_arr[0].Name[sig_count]);<br />
<br />
			<br />
			sig_count ++;<br />
		<br />
		}<br />
				<br />
		TSimHeader_arr[0].SignalCount = sig_count;<br />
		<br />
		writeRfmData();<br />
		createRandNum();<br />
}

GeneralRe: what function will convert a char to its number value Pin
John R. Shaw14-Jul-03 7:23
John R. Shaw14-Jul-03 7:23 
AnswerRe: what function will convert a char to its number value Pin
Mike Dimmick11-Jul-03 9:47
Mike Dimmick11-Jul-03 9:47 
GeneralRe: what function will convert a char to its number value Pin
Daniel Turini11-Jul-03 10:15
Daniel Turini11-Jul-03 10:15 
GeneralRe: what function will convert a char to its number value Pin
Mike Dimmick11-Jul-03 12:19
Mike Dimmick11-Jul-03 12:19 
GeneralRe: what function will convert a char to its number value Pin
Daniel Turini11-Jul-03 23:48
Daniel Turini11-Jul-03 23:48 
GeneralRe: what function will convert a char to its number value Pin
Mike Dimmick12-Jul-03 1:16
Mike Dimmick12-Jul-03 1:16 
AnswerRe: what function will convert a char to its number value Pin
drabudawood13-Jul-03 20:12
drabudawood13-Jul-03 20:12 
QuestionWhy is the constructor protected ? Pin
Shay Harel11-Jul-03 7:25
Shay Harel11-Jul-03 7:25 
AnswerRe: Why is the constructor protected ? Pin
John M. Drescher11-Jul-03 7:40
John M. Drescher11-Jul-03 7:40 
GeneralRe: Why is the constructor protected ? Pin
Shay Harel11-Jul-03 7:43
Shay Harel11-Jul-03 7:43 
GeneralRe: Why is the constructor protected ? Pin
John M. Drescher11-Jul-03 7:50
John M. Drescher11-Jul-03 7:50 
GeneralRe: Why is the constructor protected ? Pin
Shay Harel11-Jul-03 7:52
Shay Harel11-Jul-03 7:52 
GeneralRe: Why is the constructor protected ? Pin
John M. Drescher11-Jul-03 7:55
John M. Drescher11-Jul-03 7:55 
GeneralRe: Why is the constructor protected ? Pin
Anthony_Yio15-Jul-03 1:27
Anthony_Yio15-Jul-03 1:27 
QuestionI don&#8217;t&#8217; know how I can find the character set like it? Pin
Alice8011-Jul-03 7:20
Alice8011-Jul-03 7:20 
AnswerRe: I don&#8217;t&#8217; know how I can find the character set like it? Pin
Mike Dimmick11-Jul-03 10:02
Mike Dimmick11-Jul-03 10:02 
GeneralRe: I don&#8217;t&#8217; know how I can find the character set like it? Pin
Alice8012-Jul-03 1:54
Alice8012-Jul-03 1:54 

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.