John Summerfield wrote:
>
> > John Summerfield wrote:
> > >
> > > I have a code fragment:
> > > struct group *grp = getgrnam(group.data());
> >
> > you have to use group.c_str() since .data() doesn't have a \0 terminator.
>
> Filled with disbelief ( the C++ primer DOES use the wo
> John Summerfield wrote:
> >
> > I have a code fragment:
> > struct group *grp = getgrnam(group.data());
>
> you have to use group.c_str() since .data() doesn't have a \0 terminator.
Filled with disbelief ( the C++ primer DOES use the word "string"), I tried it.
It works.
W
John Summerfield wrote:
>
> According to the C++ primer which I have before me,
> The data() method returns a pointer to the first element of a string formed
> by copying elements from the range [begin,end).
>
> (the broken bracket/parentheses pairing belongs to the book too).
It deals with no
John Summerfield wrote:
>
> I have a code fragment:
> struct group *grp = getgrnam(group.data());
you have to use group.c_str() since .data() doesn't have a \0 terminator.
-- Leventehttp://petition.eurolinux.org/index_html
"The only thing worse than not
I'm leaving the other bits in for those who like the whole story.
This works:
{ // validate program name
struct stat statbuf;
int statret=stat(program.data(),&statbuf);
if (statret == -1)
{
cer
John Summerfield wrote:
>
> I have a code fragment:
> struct group *grp = getgrnam(group.data());
> if (grp == NULL)
> {
> int E=errno;
> cerr << "error=" << E << ": " << strerror(E) << " " <<
>ENOM
I have a code fragment:
struct group *grp = getgrnam(group.data());
if (grp == NULL)
{
int E=errno;
cerr << "error=" << E << ": " << strerror(E) << " " <<
ENOMEM<< endl;;
cer