[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing directories and getting filedates
Felix Kollmann wrote:
> > >...getting the time and date of a file (packed).
> >
> > stat(2)
> 
> Does not work correctly. Every time I get a SIGSEGV.
RTFM dude - I use stat and fstat all the time - they
work just fine. You probably forgot to create the
"struct stat" that it needs:
eg
  /* How big is the passwd file? */
  #include <stdio.h>
  #include <sys/stat.h>
  #include <unistd.h>
  int main ()
  {
    struct stat mybuffer ;
    if ( stat ( "/etc/passwd", &mybuffer ) == 0 )
      printf ( "The size of /etc/passwd is %db\n",
                 mybuffer.st_size ) ;
    else
      fprintf ( stderr, "Couldn't stat /etc/passwd\n" ) ;
  }
> > >...changing directories without using popen() ?
> >
> > chdir(2)
> 
> Does not work correctly. The directories created with mkdir are
> unsccessable by the programme.
Not if you create them with the right permissions. Once again,
RTFM, I use chdir a lot and it's OK.
-- 
Steve Baker                (817)619-2657 (Vox/Vox-Mail)
Raytheon Systems Inc.      (817)619-2466 (Fax)
Work: sjbaker@hti.com      http://www.hti.com
Home: sjbaker1@airmail.net http://web2.airmail.net/sjbaker1