question concerning std::getline

Started by
7 comments, last by CProgrammer 20 years, 6 months ago
Is there a function that does what std::getline does, but takes more than one delimiter? I want it to stop after line breaks and spaces: '' '' ^ ''\n'' -CProgrammer
Advertisement
It would be very easy to write your own.
I had the same problem a while back with ignoring comments behind '';''s in script files, it ended up I had to write my own function.
The ''extraction operator'' uses both spaces and newlines as delimiters iirc.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
boost::tokenizer

- Magmai Kai Holmlor

Not For Rent

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]
[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I can easily write my own String tokenizer in C but im trying to cut back on code and stick to C++.
magmai: Is boost::tokenizer a part of stl or what exactly are you refering to.
Extrarius: extraction operator? Coiuld you be more precise, perhaps an example.
Thanks
-CProgrammer
quote:Original post by CProgrammer
I can easily write my own String tokenizer in C but im trying to cut back on code and stick to C++.
magmai: Is boost::tokenizer a part of stl or what exactly are you refering to.
Extrarius: extraction operator? Coiuld you be more precise, perhaps an example.
Thanks
-CProgrammer


boost::tokenizer is part of Boost.

See link in sig.

[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
extraction operator: >>

I guess you can use that if its only whitspace and line breaks you need it to stop at.
Thanks guys the ''extraction operator'' is perfect.

-CProgrammer

This topic is closed to new replies.

Advertisement