char suffix[9]; // yyyymmdd\0 time_t now = time(NULL); struct tm *local = localtime(&now); strftime(suffix, sizeof(suffix), "%Y%m%d", local);