我知道FILE是一個typedef-ed結構,但我可以在哪裏查找使用手冊頁的struct FILE的實際定義?在Unix中定義的文件在哪裏
3
A
回答
5
如果你開始在/usr/include/stdio.h
,你會發現這條線:
typedef struct _IO_FILE FILE;
就在/usr/include
grepping爲__IO_FILE
表明,該結構在/usr/include/libio.h
我/usr/include/libio.h
定義顯示__IO_FILE
定義如下:
struct _IO_FILE {
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
#define _IO_file_flags _flags
/* The following pointers correspond to the C++ streambuf protocol. */
/* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
char* _IO_read_ptr; /* Current read pointer */
char* _IO_read_end; /* End of get area. */
char* _IO_read_base; /* Start of putback+get area. */
char* _IO_write_base; /* Start of put area. */
char* _IO_write_ptr; /* Current put pointer. */
char* _IO_write_end; /* End of put area. */
char* _IO_buf_base; /* Start of reserve area. */
char* _IO_buf_end; /* End of reserve area. */
/* The following fields are used to support backing up and undo. */
char *_IO_save_base; /* Pointer to start of non-current get area. */
char *_IO_backup_base; /* Pointer to first valid character of backup area */
char *_IO_save_end; /* Pointer to end of non-current get area. */
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
#if 0
int _blksize;
#else
int _flags2;
#endif
_IO_off_t _old_offset; /* This used to be _offset but it's too small. */
#define __HAVE_COLUMN /* temporary */
/* 1+column number of pbase(); 0 is unknown. */
unsigned short _cur_column;
signed char _vtable_offset;
char _shortbuf[1];
/* char* _save_gptr; char* _save_egptr; */
_IO_lock_t *_lock;
#ifdef _IO_USE_OLD_IO_FILE
};
struct _IO_FILE_complete
{
struct _IO_FILE _file;
#endif
#if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
_IO_off64_t _offset;
# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
/* Wide character stream stuff. */
struct _IO_codecvt *_codecvt;
struct _IO_wide_data *_wide_data;
struct _IO_FILE *_freeres_list;
void *_freeres_buf;
size_t _freeres_size;
# else
void *__pad1;
void *__pad2;
void *__pad3;
void *__pad4;
size_t __pad5;
# endif
int _mode;
/* Make sure we don't get into trouble again. */
char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
#endif
};
+4
好的答案,但我想補充一點,'FILE'就是所謂的*不透明類型*。你*不*打算看它的定義;它用於C標準庫的內部使用,並且其他代碼不應該在其內部查看。各個平臺和版本的細節差異很大。 – 2013-03-22 01:46:10
+0
@ ErnestFriedman-Hill我喜歡你對_opaque type_的解釋。 – SIFE 2013-03-22 01:52:22
相關問題
- 1. 自定義nanorc文件在哪裏?
- 2. GWT Guava gwt.xml定義文件在哪裏?
- 3. SIGUNUSED在頭文件中的定義在哪裏?
- 4. callback()的定義在哪裏?
- 5. HTML5文檔類型定義在哪裏?
- 6. 在mathjs中pi定義在哪裏?
- 7. 在CPython中定義os.stat()在哪裏?
- 8. Widget.Material.Light.TextView.ListSeparator在哪裏定義?
- 9. XMLHttpRequest.responseStream在哪裏定義?
- 10. UDP_TABLE_CLASS值在哪裏定義?
- 11. kill_proc_info定義在哪裏?
- 12. Enum.values()定義在哪裏?
- 13. ERROR_PENDING在哪裏定義?
- 14. FireDAC pbByNumber在哪裏定義?
- 15. BCRYPT_HASH_FUNCTION_TABLE在哪裏定義?
- 16. _kCLLocationAccuracyBest在哪裏定義?
- 17. 定義yearMonthDuration在哪裏?
- 18. OSTYPE_solaris定義在哪裏
- 19. NSLineSeparatorCharacter在哪裏定義?
- 20. c中定義的const SOMAXCONN在哪裏?
- 21. PhantomJS中的「出口」在哪裏定義?
- 22. Go中定義的io庫在哪裏?
- 23. web.config中定義的TargetFrameworkSDKToolsDirectory在哪裏
- 24. 文件系統上的UNIX套接字在哪裏?
- 25. 在ruby文檔中,string.chars是在哪裏定義的?
- 26. 你在哪裏定義的Spring bean配置文件
- 27. 我的php.ini文件位置在哪裏定義?
- 28. 如何定義你的app.config文件在哪裏讀取它?
- 29. ASP.NET MVC 2:在哪裏把自定義的JS文件?
- 30. 我應該在哪裏放置自定義的.d.ts文件?
查看'/ usr/include/libio.h'中的struct _ IO_FILE' – perreal 2013-03-22 01:35:48