fix_filename_slashes(3alleg4)
π fix_filename_slashes β Allegro manual, bestie edition
okay so you're reading the Allegro manual and you landed on fix_filename_slashes, which is genuinely one of the most useful lil functions in the whole game programming library. she's a 3alleg4 girlie and she's here to fix your slashes. no cap.
β¨ NAME β¨
fix_filename_slashes β converts all the directory separators to a standard character. Allegro game programming library. π
π¦ SYNOPSIS π¦
#include <allegro.h>
char *fix_filename_slashes(char *path);
πΈ DESCRIPTION πΈ
okay so picture this: you've got a filename sitting in path, and the directory separators in it are a whole mess β some slashes, some backslashes, chaos, it's giving unhinged. this function converts all of them to one standard character. periodt. π
which character is "standard" depends on where you are:
- On DOS and Windows platforms, the standard separator is a backslash.
- On most other platforms, it's a slash.
and here's the example, verbatim, because I would never mess with your code bestie:
char buf[200] = "c:/dos\\backup/weirdo\\test";
...
fix_filename_slashes(buf);
/* Under DOS we would have c:\dos\backup\weirdo\test.
Under Unix we would have c:/dos/backup/weirdo/test. */
look at her go π§ one call and every separator is matching. iconic behaviour fr fr.
π RETURN VALUE π
returns a copy of the path parameter. that's it. that's the whole vibe. π«Ά
π SEE ALSO π
lowkey obsessed with how simple this one is. no gotchas, no footguns, just slashes getting their life together β¨
so yeah bestie, that's the whole page π this was Allegro, version 4.4.3, and fix_filename_slashes(3alleg4) is out here doing the lord's work one separator at a time. go fix some paths, you got this ππΈπ
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms