peek()

描述

回传档案未读资料中的第一个字元,回传后不把该字元认为是已读。由于没有把回传的字元认为是已读,所以如果没有呼叫 read() 每次呼叫 peek() 都会得到同一个字元。

peek() 是从 Stream 继承而来。

语法


file.peek()

参数

file:被 SD.open() 回传的 File 物件

回传

int:回传档案未读资料中最前面的字元,如果没有未读资料可以读回传 -1

See Also

available()
read()
write()
Stream.peek()


函式库参考主页面

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.