Skip to content

Instantly share code, notes, and snippets.

View sant123's full-sized avatar
🇨🇴

Santiago Aguilar Hernández sant123

🇨🇴
  • Gorilla Logic
  • Colombia
View GitHub Profile
@sant123
sant123 / readin.c
Last active June 17, 2020 02:08 — forked from 1995eaton/readin.c
C stdin reader example with dynamic memory allocation
#include <stdio.h>
#include <stdlib.h>
static char *read_stdin(void)
{
size_t cap = 4096, /* Initial capacity for the char buffer */
len = 0; /* Current offset of the buffer */
char *buffer = malloc(cap * sizeof(char));
int c;