utimes

#include < sys/time.h >

#include < time.h >
#include < stdio.h >

int main(){
    struct timeval times[2];
    struct tm t;
    
    t.tm_sec = 7;
    t.tm_min = 14;
    t.tm_hour = 12;
    t.tm_mday = 19;
    t.tm_mon = 0;
    t.tm_year = 138;
    t.tm_isdst = 0;
    times[0].tv_sec = mktime(&t);
    times[0].tv_usec = 0;
    times[1] = times[0];
    
    if (utimes("file.txt",times) < 0){
        perror("utimes");
        return 1;
    }
    return 0;
}

utime

#include 
#include 

#include 
#include 

int main()
{
    struct utimbuf buf;
    struct tm t;
    
    t.tm_sec = 7;
    t.tm_min = 14;
    t.tm_hour = 12;
    t.tm_mday = 19;
    t.tm_mon = 0;
    t.tm_year = 138;
    t.tm_isdst = 0;
    buf.actime =mktime(&t);
    buf.modtime = buf.actime;
    
    if (utime("file.txt", &buf) < 0){
        perror("utime");
        return 1;
    }
    return 0;
}

lstat

#include < sys/types.h >
#include < sys/stat.h >
#include < unistd.h >

#include < time.h >
#include < stdio.h >

int main()
{
    struct stat buf;
    
    if(lstat("file.txt", &buf) < 0){
        perror("lstat");
        return 1;
    }
    
    printf("%s", ctime(&buf.st_mtime));
    return 0;
}

stat

#include < sys/types.h >
#include < sys/stat.h >
#include < unistd.h >

#include 
#include 

int main(){
    struct stat buf;
    
    if (stat("file.txt", &buf) < 0){
        perror("stat");
        return 1;
    }
    printf("%s", ctime(&buf.st_mtime));
    return 0;
}

truncate

#include < sys/types.h >
#include < unistd.h >

#include 

int main(){
    if (truncate("file.txt", 10) < 0){
        perror("truncate");
        return 1;
    }
    return 0;
}

readlink

#include 
#include 

int main()
{
    ssize_t n;
    char buf[4096];
    
    if ((n = readlink("newfile.txt", buf, sizeof buf - 1)) < 0){
        perror("readlink");
        return 1;
    }
    
    buf[n] = '\0';
    printf("%s\n", buf);
    
    return 0;
}

rmdir

#include < unistd.h >
#include < stdio.h >

int main(){
    if (rmdir("work") < 0){
        perror("rmdir");
        return 1;
    }
    return 0;
}