OS Manuals

touch(3ast)

touch - set file access and modify times

TOUCH(3ast) TOUCH(3ast)

touch - set file access and modify times

#include <ast.h>

int touch(const char* path, time_t atime, time_t mtime, int force);

touch sets the access and modify times of the file named by path. If force != 0 then the file is created if it doesn't exist; otherwise the file is not created and -1 is returned. If force < 0 then atime and mtime are taken verbatim; otherwise (time_t)(-1) retains the current value for the file and (time_t)(0) uses the current time.

By default the change time is always changed to the current time.

ksh 1.0.10-r36 · os · ingested 2026-09-30