最近考试用fread然后对拍的时候发现拍出来的文件不一样,但是关掉freopne之后运行输出的是一样的,有人知道为什么吗(
const int BUF_SIZE = 1 << 12;
char buf[BUF_SIZE] , *buf_s = buf , *buf_t = buf + 1;
#define PTR_NEXT() \
{ \
buf_s ++; \
if(buf_s == buf_t) \
{ \
buf_s = buf; \
buf_t = buf + fread(buf , 1 , BUF_SIZE , stdin); \
} \
}
template <typename _n_> void mian(_n_ & _x_){
while(*buf_s != '-' && !isdigit(*buf_s)) PTR_NEXT();
bool register _nega_ = false; if(*buf_s == '-'){ _nega_ = true; PTR_NEXT(); }
_x_ = 0; while(isdigit(*buf_s)){ _x_ = _x_ * 10 + *buf_s - '0'; PTR_NEXT(); } if(_nega_) _x_ = -_x_;
}