c-md/srcs/io/streams.c.md
lohhiiccc 80f7a1b9b6 feat(build): add build instructions in README and convert sources to .c.md format
- Add detailed build and bootstrap instructions to README.md.
 - Convert all source and header files from .c/.h to .c.md/.h.md.
 - Add bootstrap.sh script for automated building across version history.
 - Update Makefile and sources.mk to reflect new markdown-based source organization.
2026-01-12 14:54:49 +01:00

34 lines
590 B
Markdown

```c
#include <stdio.h>
#include "io.h"
int8_t
io_open(t_io *io, const char *input_path, const char *output_path)
{
io->in = (NULL != input_path) ? fopen(input_path, "r") : stdin;
if (NULL == io->in)
{
perror(input_path);
return (1);
}
io->out = (NULL != output_path) ? fopen(output_path, "w") : stdout;
if (NULL == io->out)
{
perror(output_path);
if (io->in != stdin)
fclose(io->in);
return (1);
}
return (0);
}
void
io_close(t_io *io)
{
if (NULL != io->in && io->in != stdin)
fclose(io->in);
if (NULL != io->out && io->out != stdout)
fclose(io->out);
}
```