Skip to content

Instantly share code, notes, and snippets.

@carun
carun / gist:4117614
Created November 20, 2012 12:20
Explode in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char **explode(char *string, char separator, int *arraySize)
{
int start = 0, i, k = 0, count = 2;
char **strarr;
for (i = 0; string[i] != '\0'; i++){
/* Number of elements in the array */
@carun
carun / Makefile
Created November 20, 2012 11:45
Advanced options in makefile
mode := release
CC := gcc
v := 0
cov := 0
arc := 64
ifeq ($(cov), 0)
else
COV_CFLAGS = -fprofile-arcs -ftest-coverage
COV_LFLAGS = -lgcov
endif
@carun
carun / Log.hpp
Created November 20, 2012 11:35
Singleton in a header only library
#include <iostream>
#include <stdint.h>
namespace Home { namespace Arun {
class Log
{
public:
static void Init(std::string& logPath, std::string& logFilename,
int32_t maxFileSize);