pop_last_segment()

pop_last_segment()#

pop_last_segment() removes and returns the last segment of a given file path, modifying the original string.

Prototype

char *pop_last_segment(char *path);

Parameters

Key

Type

Description

path

char *

A mutable string representing a file path. The function modifies this string in place.


Return Value

A pointer to the last segment of the path. The original path string is modified, with the last segment removed.

Notes

If no ‘/’ is found in path, the entire string is returned, and path remains unchanged.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples