Commit d9df7bd2 authored by saeed's avatar saeed
Browse files

sflib is added

parent 5f0c45ae
#ifndef SFLIB_H
#define SFLIB_H
char *readlinesfromfile(char *fname, long int *len){
char *content = NULL;
FILE *fin = NULL;
fin = fopen(fname,"r");
*len = -1;
if (fin != NULL){
long int fs = 0L;
fseek(fin,0,SEEK_END);
fs = ftell(fin);
fseek(fin,0,SEEK_SET);
content = (char *)malloc(fs+1);
fread(content,1,fs,fin);
content[fs] = '\0';
*len = (fs +1);
fclose(fin);
}
return content;
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment