03-29-2004
>>>>First of all, stat() does not return 1 on failure - it returns -1.
sorry typo it is -1 in my source....
should of used copy paste
>>>>Second, what's ``pathname'' defined as?
pathname is a const char* pathname
as in
function( DIR* dirPtr, const char* pathname)
>>In the loop of your example code, you should be calling
>>stat(dir->d_name, &fInfo);
>>to check every file.
i am currently outputting the file names and it does hit every file
(lots of error code checking in this)
however i tried the dir->d_name instead of pathname
and it again loops thru however every loop thru displays
CANT STAT along with 12/31/69 as the last time it was modified
output
Error on file text.txt, cannot stat.
text.txt 12/31/69
10 More Discussions You Might Find Interesting
1. Programming
Hi
We are using a code generator for initializing structures with the #define macro. Compiling it with the GCC 2.8.1 (with -ansi) it OK. But when we are using the SUN C 5.0 compiler it screams.
Following is a code sample:
#include <stdlib.h>
#include <stdio.h>
typedef struct TEST3 {... (4 Replies)
Discussion started by: amatsaka
4 Replies
2. Programming
hi all ,
can i save a structure in c in a file? how ?
help me , thx. :) (2 Replies)
Discussion started by: kall_ANSI
2 Replies
3. Programming
Hi,
I am trying to understand an very old C program.
....
time_t start, end;
ptr = localtime(&start);
...
fprintf(out, "%-35s 01 %5s %2s %10d 1 5 /tty/M%d/%02d %24s", buffer3, job, ver, start, mach_num,atoi(buffer), asctime(ptr));
fprintf(out, "%-35s 03 %5s %2s %10d 1 5... (9 Replies)
Discussion started by: whatisthis
9 Replies
4. Programming
I receive an integer as argument for a function.
within function definition i want it to be of type struct tm.
eg..
main()
{
int a;
......
}
function(...,..,a,..)
int a;
{
struct tm tm;
if(!a)
^ time(&a);
^ ... (4 Replies)
Discussion started by: bankpro
4 Replies
5. Linux
Hi,
I am working on gcov.Meaning, analysing the functionality of gcov. There is one structure called "struct bb". I am not sure, how struct bb members are getting assigned values. If anyone knows how it is happening pls let me know.
Thanks in advance.
--Vichu (0 Replies)
Discussion started by: Vichu
0 Replies
6. UNIX for Dummies Questions & Answers
Can someone tell me how to do this?
Just a thought that entered my mind when learning about structs.
First thought was:
struct one
{
struct two;
}
struct two
{
three;
}
one->two->three
would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies
7. Programming
in C i am using this code to get the c time or a time or m time
struct dirent *dir;
struct stat my;
stat(what, &my);
thetime = my.st_ctime;
How can i check if i have permission to check the c time of the file? (1 Reply)
Discussion started by: omega666
1 Replies
8. UNIX for Dummies Questions & Answers
what is struct winsize used for?
i tried looking it up, but no luck. (0 Replies)
Discussion started by: l flipboi l
0 Replies
9. Programming
Hi,
I have received an application that stores some properties in a file. The existing struct looks like this:
struct TData
{
UINT uSizeIncludingStrings;
// copy of Telnet data struct
UINT uSize;
// basic properties:
TCHAR szHost; //defined in Sshconfig
UINT iPortNr;
TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies
10. Programming
I have many headers with huge amount of structures in them, typical one looks like this:
$ cat a.h
struct Rec1 {
int f1;
int f2;
};
struct Rec2 {
char r1;
char r2;
};
struct Rec3 {
int f1;
float k1;
float ... (6 Replies)
Discussion started by: migurus
6 Replies
LEARN ABOUT FREEBSD
archive_entry_atime_nsec
ARCHIVE_ENTRY_TIME(3) BSD Library Functions Manual ARCHIVE_ENTRY_TIME(3)
NAME
archive_entry_atime, archive_entry_atime_nsec, archive_entry_atime_is_set, archive_entry_set_atime, archive_entry_unset_atime,
archive_entry_birthtime, archive_entry_birthtime_nsec, archive_entry_birthtime_is_set, archive_entry_set_birthtime,
archive_entry_unset_birthtime, archive_entry_ctime, archive_entry_ctime_nsec, archive_entry_ctime_is_set, archive_entry_set_ctime,
archive_entry_unset_ctime, archive_entry_mtime, archive_entry_mtime_nsec, archive_entry_mtime_is_set, archive_entry_set_mtime,
archive_entry_unset_mtime, -- functions for manipulating times in archive entry descriptions
LIBRARY
Streaming Archive Library (libarchive, -larchive)
SYNOPSIS
#include <archive_entry.h>
time_t
archive_entry_atime(struct archive_entry *a);
long
archive_entry_atime_nsec(struct archive_entry *a);
int
archive_entry_atime_is_set(struct archive_entry *a);
void
archive_entry_set_atime(struct archive_entry *a, time_t sec, long nanosec);
void
archive_entry_unset_atime(struct archive_entry *a);
time_t
archive_entry_birthtime(struct archive_entry *a);
long
archive_entry_birthtime_nsec(struct archive_entry *a);
int
archive_entry_birthtime_is_set(struct archive_entry *a);
void
archive_entry_set_birthtime(struct archive_entry *a, time_t sec, long nanosec);
void
archive_entry_unset_birthtime(struct archive_entry *a);
time_t
archive_entry_ctime(struct archive_entry *a);
long
archive_entry_ctime_nsec(struct archive_entry *a);
int
archive_entry_ctime_is_set(struct archive_entry *a);
void
archive_entry_set_ctime(struct archive_entry *a, time_t sec, long nanosec);
void
archive_entry_unset_ctime(struct archive_entry *a);
time_t
archive_entry_mtime(struct archive_entry *a);
long
archive_entry_mtime_nsec(struct archive_entry *a);
int
archive_entry_mtime_is_set(struct archive_entry *a);
void
archive_entry_set_mtime(struct archive_entry *a, time_t sec, long nanosec);
void
archive_entry_unset_mtime(struct archive_entry *a);
DESCRIPTION
These functions create and manipulate the time fields in an archive_entry. Supported time fields are atime (access time), birthtime (cre-
ation time), ctime (last time an inode property was changed) and mtime (modification time).
libarchive(3) provides a high-resolution interface. The timestamps are truncated automatically depending on the archive format (for archiv-
ing) or the filesystem capabilities (for restoring).
All timestamp fields are optional. The XXX_unset() functions can be used to mark the corresponding field as missing. The current state can
be queried using XXX_is_set(). Unset time fields have a second and nanosecond field of 0.
SEE ALSO
archive(3), archive_entry(3)
HISTORY
The libarchive library first appeared in FreeBSD 5.3.
AUTHORS
The libarchive library was written by Tim Kientzle <kientzle@acm.org>.
BSD
February 2, 2012 BSD