Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 c 读取一个文件,我试图从一个文本文件中一次读取一个 UTF-16 字符,这是 2 个字节。我很生疏,但这是我所拥有的:
FILE *fp; fp = fopen( "myfile.txt" , 'r' ); size_t readIn; size_t* readp = &readIn; fread( readp , 2 , 1 , fp );
不知何故,这对我来说感觉不对,但我不知道为什么。
我更喜欢使用:
unsigned char readp[2]; while((fread(readp,2,1,fp) == 1) { }