2017-09-15 37 views
0

我一直在嘗試使用此程序來查找文件大小,以及我要如何使用open( )函數需要一個標誌,但是當我輸入正確的標誌時它說它還沒有被聲明。這是行和我有的進口。當使用open()時,它不會找到我正在嘗試使用的標誌

# include <stdio.h> 
# include <unistd.h> 
# include <stdlib.h> 
# include <string.h> 
# include <sys/types.h> 
# include <sys/stat.h> 

int filedescriptor = open(filename, O_RDONLY); 

我確定我錯過了一些簡單的東西。

+5

該標誌位於'' –

+0

'man open'列出了所有必需的包括。 –

+0

@EugeneSh。也許'man 3 open' :-) – Amadeus

回答

2

您missining #include <fcntl.h>

注意,在man(3)你,會發現POSIX規範,而在man(2)系統的具體實施方案(如有)。

其實man(3)POSIX程序員手冊man(2)的Linux程序員手冊

請注意,這並非總是如此,但大多數POSIX函數也有一個man(2)頁面。

相關問題