By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,820 Members | 1,187 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,820 IT Pros & Developers. It's quick & easy.

type convertion

P: n/a
Kay
This function is loaded a txt file and add these data in a queue. Hence,
it is allowed to input an integer. I want to use this integer to call
back the suitable node in the queue. The problem is how to convert char*
to int. OR it have an alternative way to solve this problem. Mode(as
below ) is storing an integer. Can it use other way to load the txt file?

/* Load the restaurant name, cuisine name
and operation mode add it in a queue */
void RestCuisineModeQueue( istream& is, Queue * ReCuMo ){

string temp_name, temp_cuisine, temp_mode;

/* get the restaurant name, cuisine name and the operation mode
from the gourmet txt file */
while ( getline(is, temp_name, ';') && getline(is, temp_cuisine, ';') &&
getline(is, temp_mode, '\n') ){

char *name, *cuisine, *mode;

//change type of name of restaurant from string to char
name = new char[temp_name.length() + 1 ];
strcpy( name, temp_name.c_str());

//change type of name of cuisine from string to char
cuisine = new char[temp_cuisine.length() + 1 ];
strcpy( cuisine, temp_cuisine.c_str());

//change type of operation mode from string to char
mode = new char[temp_mode.length() + 1 ];
strcpy( mode, temp_mode.c_str());

//cout << name << cuisine << mode << endl;

QueueInsert( ReCuMo, name, cuisine, mode);
}
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Kay" <er*********@yahoo.com.hk> wrote in message
news:41************@yahoo.com.hk...
This function is loaded a txt file and add these data in a queue. Hence,
it is allowed to input an integer. I want to use this integer to call
back the suitable node in the queue. The problem is how to convert char*
to int. OR it have an alternative way to solve this problem. Mode(as
below ) is storing an integer. Can it use other way to load the txt file?


Did you not read the replies you already got?

-Mike
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.