this code is surrposed to create a pipe place two messages on it then read them off.
Code:
#include <unistd.h>
#include <stdio.h>
#define msgSize 8
char *lock = "1";
char *unlock = "2";
main(){
char inbuf[msgSize];
int p[2], j;
/* open the pipe */
if (pipe(p) == -1){
perror("pipe call");
exit(1);
}
/* write the messages */
write(p[1], lock, msgSize);
write(p[1], unlock, msgSize);
for(j = 0; j < 3; j++){
read(p[0], inbuf, msgSize);
printf("%s\n", inbuf);
}
exit(0);
}
[\code]
I get an error message when I try to build the message says
Linker Error (Severity 4)
Module "a" in file "app.obj"
references unresolved external "_pipe"
at offset 000DH in segment "_text".
Linker Error (Severity 4)
Module "a" in file "app.obj"
references unresolved external "_perror"
at offset 0045H in segment "_text".
can anyone help?