943,844 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1881
  • C RSS
Oct 22nd, 2006
0

converting from string to char*

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
taineechan is offline Offline
17 posts
since Oct 2006
Oct 22nd, 2006
0

Re: converting from string to char*

Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Oct 22nd, 2006
0

Re: converting from string to char*

thanks...it works now
Reputation Points: 10
Solved Threads: 1
Newbie Poster
taineechan is offline Offline
17 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Signal Processing: Hadamard Matrices
Next Thread in C Forum Timeline: need help on linked list





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC