Here's a detab utility.
This should bread and butter code. In fact it is tricky to ensure that a
malicious user cannot cause a buffer overrun. Hence the maxmemory() routine.
getline() is also difficult.
Utility to replaces tabs in text files with spaces.
Can either do a blind replace or replace with user-specifed tab stops
By Malcolm McLean, 2009
- include <stdio.h>
- include <stdlib.h>
- include <string.h>
- include <limits.h>
- include <assert.h>
count the occurences of ch in str
size_t chcount(const char *str, int ch)
size_t answer = 0;
if(*str++ == ch)
is a string an integer?
int integral(char *str)
x = strtol(str, &end, 10);
if(x > INT_MAX || x < INT_MIN)
check that an array of integers is ascending...