On this page
  1. rename
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

rename

Prev: remove | Up: stdio.h | Next: setvbuf
Rel: stdio.h, stdio.h & File I/O Guide
Ref: cppreference — rename
Tags: #public #prog #c #stdlib #stdio #tier/standard


Include

#include <stdio.h>

Signature & Overview

int rename(const char *old_path, const char *new_path);

Renames or moves a file atomically within the same filesystem; returns 0 on success.

Notes & Pitfalls

Example

#include <stdio.h>

int main(void) {
    // Atomic replace pattern: write temp file -> fclose() -> rename(tmp, dst)
    (void)rename;
}

Linked from

Related notes