Click here to Skip to main content
15,886,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to write mic data to .wav file ? Pin
Souldrift22-Sep-09 22:39
Souldrift22-Sep-09 22:39 
QuestionString split functionality Pin
NarVish22-Sep-09 21:07
NarVish22-Sep-09 21:07 
AnswerRe: String split functionality Pin
chandu00422-Sep-09 21:09
chandu00422-Sep-09 21:09 
AnswerRe: String split functionality Pin
Hamid_RT22-Sep-09 21:30
Hamid_RT22-Sep-09 21:30 
GeneralRe: String split functionality Pin
NarVish22-Sep-09 21:37
NarVish22-Sep-09 21:37 
GeneralRe: String split functionality Pin
CPallini22-Sep-09 22:09
mveCPallini22-Sep-09 22:09 
GeneralRe: String split functionality Pin
NarVish22-Sep-09 23:59
NarVish22-Sep-09 23:59 
GeneralRe: String split functionality Pin
CPallini23-Sep-09 0:25
mveCPallini23-Sep-09 0:25 
You don't need strtok for dealing with std::string. Use std::string.find instead. For instance
#include <string>
#include <iostream>
void main()
{
  const int SIZE = 10;
  std::string s[SIZE];
  std::string str = "Hello folks, welcome!";
  int i;
  int start_pos, end_pos = 0;
  for (i = start_pos=0; i <SIZE && (end_pos = str.find(' ', start_pos)) != std::string::npos; i++)
  {
    s[i] = str.substr(start_pos, end_pos-start_pos+1);
    start_pos=end_pos+1;
  }
  if ( start_pos < str.length() && i < SIZE)
  {
    s[i] = str.substr(start_pos, str.length()- start_pos+1);
    i++;
  }

  for (int j=0; j<i; j++)
  {
    std::cout << "s[" << j << "]=" << s[j] << std::endl;
  }

}


If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: String split functionality Pin
Richard MacCutchan23-Sep-09 0:30
mveRichard MacCutchan23-Sep-09 0:30 
AnswerRe: String split functionality Pin
CPallini22-Sep-09 21:37
mveCPallini22-Sep-09 21:37 
QuestionMessage box display twice Pin
jadhavjitendrar22-Sep-09 20:51
jadhavjitendrar22-Sep-09 20:51 
AnswerRe: Message box display twice Pin
theCPkid22-Sep-09 21:40
theCPkid22-Sep-09 21:40 
Questionautomation files and excel Pin
prithaa22-Sep-09 20:40
prithaa22-Sep-09 20:40 
QuestionHelp with regex in VS2008 Pin
theCPkid22-Sep-09 20:22
theCPkid22-Sep-09 20:22 
AnswerRe: Help with regex in VS2008 Pin
theCPkid22-Sep-09 21:37
theCPkid22-Sep-09 21:37 
QuestionSave as Excel file Pin
Davitor22-Sep-09 19:58
Davitor22-Sep-09 19:58 
AnswerRe: Save as Excel file Pin
Davitor22-Sep-09 21:29
Davitor22-Sep-09 21:29 
GeneralRe: Save as Excel file Pin
Chandrasekharan P23-Sep-09 4:06
Chandrasekharan P23-Sep-09 4:06 
GeneralRe: Save as Excel file Pin
Davitor23-Sep-09 18:13
Davitor23-Sep-09 18:13 
QuestionODBC error: Expression too complex Expression too complex [modified] Pin
narendra91122-Sep-09 18:53
narendra91122-Sep-09 18:53 
GeneralRe: ODBC error: Expression too complex Expression too complex [modified] Pin
narendra91123-Sep-09 5:44
narendra91123-Sep-09 5:44 
QuestionODBC error: Expression too complex Pin
narendra91122-Sep-09 18:52
narendra91122-Sep-09 18:52 
GeneralRe: ODBC error: Expression too complex [modified] Pin
narendra91123-Sep-09 5:44
narendra91123-Sep-09 5:44 
QuestionCalling The Thread function Pin
VVVimal22-Sep-09 18:50
VVVimal22-Sep-09 18:50 
AnswerRe: Calling The Thread function Pin
Naveen22-Sep-09 19:26
Naveen22-Sep-09 19:26 

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.