int sync();
true
)來訪問輸入序列。然後(如果 good),它會對其關聯的*流緩衝區*物件呼叫 pubsync(如果 rdbuf 為 null,則該函式返回 -1
)。最後,在返回前銷燬 sentry 物件。-1
),則函式將設定 badbit 標誌,並返回 -1
。否則返回零,表示成功。-1
。flag | error |
---|---|
eofbit | - |
failbit | 構造 sentry 失敗(例如,當呼叫前的 *流狀態* 不是 good 時)。 |
badbit | 呼叫 pubsync 失敗,或流上發生其他錯誤(例如,函式捕獲了內部操作丟擲的異常)。 設定後,流的完整性可能受到影響。 |
|
|
Please, enter a word: test Please enter another word: text The first word began by t The second word began by t |