看板 b92902xxx 關於我們 聯絡資訊
同學你好, 期中考第七題寫 101th (100th) 或是 201th (200th) 都可以得到 完整的四分,如果你的答案是 201th (200th) 被扣分的,請帶著 你的考卷到 438 室找彭念劬助教更正。 我下午和晚上一般都會在實驗室,週二下課時也會到教室去,如有 不便之處還請見諒。 SP2005 課程助教 彭念劬 答案更正原因如下: =========================================================== If you write a program like the followings: fd = fopen("ascii.dat", "r"); fn = fileno(fd); fgetc(fd); fseek(fd, 100, SEEK_SET); lseek(fn, 200, SEEK_SET); printf("%d\n", fgetc(fd)); You will get the 101th character. However if you write a program like this: fd = fopen("ascii.dat", "r"); fn = fileno(fd); fseek(fd, 100, SEEK_SET); lseek(fn, 200, SEEK_SET); printf("%d\n", fgetc(fd)); You will get the 201th character. This is because the stream buffer of fd is totally empty before the fseek() is invoked. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.23.113 ※ 編輯: NeilPeng 來自: 140.113.23.113 (05/20 04:32)