converting from string to char*

Reply

Join Date: Oct 2006
Posts: 17
Reputation: taineechan is an unknown quantity at this point 
Solved Threads: 1
taineechan's Avatar
taineechan taineechan is offline Offline
Newbie Poster

converting from string to char*

 
0
  #1
Oct 22nd, 2006
I want to find the length of a string, But the strlen function seems only to work with chars. I can't use a char[] to store my text because the size must be known beforehand and I don't know it. So I read everything into a string, then tried to convert it to a char like this.

  1. string count;
  2. char* count1=(char*(count));

This gives an error that expects a comma or semi-colon before 'char'..
How can I convert from string to char*? and if there is no way to do this, can anyone think of another way of counting the no. of characters in a trie structure aside from reading everything into a string and getting the length of it as I am trying to do?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: converting from string to char*

 
0
  #2
Oct 22nd, 2006
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 17
Reputation: taineechan is an unknown quantity at this point 
Solved Threads: 1
taineechan's Avatar
taineechan taineechan is offline Offline
Newbie Poster

Re: converting from string to char*

 
0
  #3
Oct 22nd, 2006
thanks...it works now
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC