Commit 9153db7b authored by Zara Saldanha's avatar Zara Saldanha

Lab 10.3

parent 03a83021
......@@ -24,7 +24,7 @@ CC = gcc
CFLAGS = -g -Wall
EXE = hexdump.o file_stat read_dir fdump traverse
EXE = sender receiver hexdump.o file_stat read_dir fdump traverse
all: $(EXE)
......@@ -55,5 +55,11 @@ traverse: traverse.o
traverse.o: traverse.c
$(CC) -c $(CFLAGS) traverse.c -o traverse.o
sender: sender.c
$(CC) $(CFLAGS) sender.c -o sender
receiver: receiver.c
$(CC) $(CFLAGS) receiver.c -o receiver
clean:
/bin/rm -f *~ *.o core $(EXE)
int main(int argc, char* argv[]){
while(1){
}
}
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <semaphore.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#define SEM "Zara"
int main(int argc, char* argv[]){
FILE *file;
file = fopen("channel.txt","a+");
fwrite(argv[1],sizeof(char),strlen(argv[1]),file);
fclose(file);
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