What I need to do is set num = 2 as it specified in server.conf. At num=atoi(strtok(NULL,"=")); I am getting segfault there or it is giving out 0. I am running linux and gcc 4.1.2.
server.conf:
myprog.c:Code:num_of_files=2;
Code:int c, num;
char buf[100],buf1[100];
c=open("./server.conf",O_RDONLY);
read(c,buf,sizeof buf);
close(c);
buf1=strtok(buf,";");
strtok(buf1,"=");
num=atoi(strtok(NULL,"=")); //I am getting segfault here or it is giving out 0.