Hello all,
I have very recently trying to make a small program in c++ and I am having problems with pointers.
I want to read a line from a file, send that line to a function that parses and stores the lines content.
So I have my
getline (myfile,line,'\ n');
fillData(line);
functions, where fillData obviously is the parser/storing function and line is a simple string.
fillData is declared as: void fillData(string line);
All fillData does at the moment is: string first = strtok(line, ' ');.
But even these simple things give me errors. And I am assuming it is because I have to use pointers and references to acctually make it work but I just cant seem to figure it out.
So Im hoping that I can get some help here.
Thanks in advance.
/Olle
I have very recently trying to make a small program in c++ and I am having problems with pointers.
I want to read a line from a file, send that line to a function that parses and stores the lines content.
So I have my
getline (myfile,line,'\ n');
fillData(line);
functions, where fillData obviously is the parser/storing function and line is a simple string.
fillData is declared as: void fillData(string line);
All fillData does at the moment is: string first = strtok(line, ' ');.
But even these simple things give me errors. And I am assuming it is because I have to use pointers and references to acctually make it work but I just cant seem to figure it out.
So Im hoping that I can get some help here.
Thanks in advance.
/Olle
Comment