pfjan at yahoo.com.br
Tue Sep 28 00:11:02 UTC 2004
if you have access to the boost library
(www.boost.org, it's quite a "standard library") and
are used to regex patterns -- if not, consider
learning it, it's very useful! --, you could do:
using namespace boost;
if ( ! directory_pattern.Match( my_string ) )
string directory = directory_pattern;
i haven't checked the regex, you can adapt it as you
see fit -- as i declared it, the directory should
start with something different than space.
i hope it helps :)
ps.: from the boost library page: " ... Ten Boost
libraries will be included in the C++ Standards
Committee's upcoming C++ Standard Library Technical
Report as a step toward becoming part of a future C++
--- Julien Claassen <julien at c-lab.de> escreveu:
> Hi all!
> I have a simple probelm, but seem to be completely
> stupid. I have a file,
> with a simple format, imagine that:
> Filename is myfile.cfg
> Entry in this file is:
> directory = /usr/share/something
> Now I want to read this in a variable. With c I
> would have done:
> fscanf(file_pointer,"directory = %s",&my_string);
> How would I do this with c++ in an ellegant
> manner? I thought of
> stringstreams, but well... I'm completely lost...
> Any help is appreciated and greatfully taken!
> Kindest regards
> Music was my first love and it will be my last (John
> ======== FIND MY WEB-PROJECT AT: ========
> http://ltsb.sourceforge.net - the Linux TextBased
> Studio guide
> This is the Linux C++ Programming List
Yahoo! Messenger 6.0 - jogos, emoticons sonoros e muita diversão. Instale agora!
More information about the tuxCPProgramming