我有一个我无法解决的愚蠢的小问题......
exer3.c: In function ‘shm_pipe_pipe’:
exer3.c:69:39: error: expected ‘)’ before ‘;’ token
exer3.c:69:39: error: too few arguments to function ‘shmget’
/usr/include/i386-linux-gnu/sys/shm.h:54:12: note: declared here
线路69周边:
pipes_array[i].m_key = 1;
key = i;
pipes_array[i].m_shmid = shmget(key, PIPE_SIZE, IPC_CREAT | IPC_EXCL | 0600); //69
if (pipes_array[i].m_shmid < 0) {
perror("Error");
return -1;
}
然后:
exer3.c: In function ‘shm_pipe_read’:
exer3.c:111:60: error: expected ‘)’ before ‘;’ token
线路111周边:
current_bytes_to_read = total_bytes_to_read <= pipes_array[i].m_bytes_in_pipe ? total_bytes_to_read : pipes_array[i].m_bytes_in_pipe;
//reading the information
if ((pipes_array[i].m_roffset + current_bytes_to_read) < PIPE_SIZE) { //111
memcpy(buf + offset, tbuffer + pipes_array[i].m_roffset, current_bytes_to_read);
然后:exer3.c:在函数'shm_pipe_write'中:exer3.c:153:41:错误:预期')'在';'之前 令牌
线路153周边:
while (total_bytes_to_write != 0) {
if (pipes_array[i].m_bytes_in_pipe == PIPE_SIZE) { //153
make: *** [exer3.o] Error 1
有人可以帮我吗?谢谢!