某一天在Android studio下瀏覽Android源碼下C++源碼時發現下圖,仍是頗有意思並且實用的hhhhh 熟悉C或C++中一門語言的同窗可參照下表來進行文件的打開,可得到等價的打開效果 如ios
fopen("/sdcard/test.txt",w+)
//至關於
if.open("/sdcard/test.txt", ios::in || ios:: out || trunc);
複製代碼
表以下:bash
/**
* @brief Opens an external file.
* @param __s The name of the file.
* @param __mode The open mode flags.
* @return @c this on success, NULL on failure
*
* If a file is already open, this function immediately fails.
* Otherwise it tries to open the file named @a __s using the flags
* given in @a __mode.
*
* Table 92, adapted here, gives the relation between openmode
* combinations and the equivalent @c fopen() flags.
* (NB: lines app, in|out|app, in|app, binary|app, binary|in|out|app,
* and binary|in|app per DR 596)
* <pre>
* +---------------------------------------------------------+
* | ios_base Flag combination stdio equivalent |
* |binary in out trunc app |
* +---------------------------------------------------------+
* | + w |
* | + + a |
* | + a |
* | + + w |
* | + r |
* | + + r+ |
* | + + + w+ |
* | + + + a+ |
* | + + a+ |
* +---------------------------------------------------------+
* | + + wb |
* | + + + ab |
* | + + ab |
* | + + + wb |
* | + + rb |
* | + + + r+b |
* | + + + + w+b |
* | + + + + a+b |
* | + + + a+b |
* +---------------------------------------------------------+
* </pre>
*/
複製代碼