Commit 62cd6f5b authored by Zara Saldanha's avatar Zara Saldanha

Update receiver.c

parent 9f99dbba
int main(int argc, char* argv[]){
while(1){
}
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(int argc, char* argv[]){
FILE *file;
char* line;
char string[150];
while(1){
int count = 0;
file = fopen("channel.txt","r");
fseek(file, 0, SEEK_END);
long file_size = ftell(file);
fseek(file,0,SEEK_SET);
char *split = malloc(file_size+1);
fread(split, file_size,1,file);
split[file_size]=0;
line = strok(split,"\n");
while(line != NULL) {
strcpy(string,line);
line = strok(NULL,"\n");
count++;
}
printf("%s\n",string);
fclose(file);
free(split);
sleep(1);
}
return 0;
}
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