Hi, I am reading from a text file and stored it onto a string variable. Now I want to split the string and I tried looking it up on the web and found the strtok () function but that only works on a char type.
Here is my code snippet:
#include <iostream>
#include "Stack.h"
#include <string.h>
#include <fstream>
using namespace std;
int main()
{
Stack list;
ifstream ReadFrom;
string line;
(getline(ReadFrom, line));
split = strtok(line.c_str(),",.( )") // this does not work.;
Can some one give me an idea on how to accomplish this. Note: variable line has to be string type unless there is another way to read whole line from a text file.
thanks.