-
String/Data Manipulation
I have some data in the following format:
gggg@ gggggggg gggggg ggggggggg
trrehd@ dffdhghtr rggffrg nhgvhvgnhgyy
po@ dkjfkdg gfdkjhjdkhf dgfgfffff ffff
ppppppoppo@ dsgjhfdkhvc gfdkjhgkj kjhgkf
Now I want to output the data that comes after the '@' for each line. Any help is much appreciated!
-
Check out the getline command
-
I'm using the Win API and because of that I can't use getline().
-
I assume the data are saved on a file and you are trying to read the data into memory.
-----
// std::getline(sourcefile, string);
// this should return the index of "@"
// int index = string.find('@');
// for (int i = ++index; i < string.size(); ++i)
// cout << string[i]
-----
The code above is a concept. You should modify it to fit your need and to optimize your program.
Kuphryn
-
windows API and STL are not mutually exclusive. You can use getline just fine.
-
I've been unable to get the getline() function to work. Any suggestions?
-
show us the line that you tried using getline().
-
I've tried the following:
Code:
getline()
std::getline()
ifstream::getline()
: error C2065: 'getline' : undeclared identifier
-
What header files have you included. Sounds to me like you are leaving one out.