typical py style

with open("test.txt", "w") as f:
    print("Hello World!", file=f)

c callback style

`#include <stdio.h>
typedef void (*operation)(FILE *f);

void withopen(const char *fname, operation callback)
{
				FILE *f = fopen(fname, "w");
				if (f == NULL) // GO: if err != nil { }
								return;
				callback(f);
				fclose(f);
}
void test(FILE *f)
{
				fprintf(f, "Hello World!\\n");
};
int main()
{
				withopen("test.txt", test);
				return 0;
}

py Path style

Path("test.txt").write_text("Hello World!\\n")