c++ good() eof() fail() bad()
来源:互联网 发布:淘宝卖家怎么举报买家 编辑:程序博客网 时间:2024/06/07 17:13
// fortest.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <string>#include <string.h>#include <map>#include <iostream>#include <stdio.h>#include <stdlib.h>#include <sstream>int main(){std::istringstream is("123");std::cout << "--------------------读取一个\n";is.get();std::cout << is.good() << std::endl;std::cout << is.eof() << std::endl;std::cout << is.fail() << std::endl;std::cout << is.bad() << std::endl;std::cout << "--------------------读取剩下的\n";char *buf = (char *)malloc(3 + 1);memset(buf, 0, 4);is.read(buf, 2);printf("%s\n", buf);std::cout << is.good()<< std::endl;std::cout << is.eof() << std::endl;std::cout << is.fail() << std::endl;std::cout << is.bad()<<std::endl;std::cout << "--------------------再读取\n";is.get();std::cout << is.good() << std::endl;std::cout << is.eof() << std::endl;std::cout << is.fail() << std::endl;std::cout << is.bad() << std::endl;std::cout << "--------------------再读取\n";is.get();std::cout << is.good() << std::endl;std::cout << is.eof() << std::endl;std::cout << is.fail() << std::endl;std::cout << is.bad() << std::endl;free(buf); return 0;}/*--------------------读取一个1000--------------------读取剩下的231000--------------------再读取0110--------------------再读取0110请按任意键继续. . .*/
0 0
- c++ good() eof() fail() bad()
- C++之cin.eof, cin.bad, cin.good, cin.fail, cin.clear
- cin.fail(), cin.bad(), cin.good(), cin.clear(), cin.ignore()
- cin.fail(), cin.bad(), cin.good(), cin.clear(), cin.ignore()
- eof() 和fail()
- c++ good eof getline
- good and bad
- Good Bad Books
- good day !bad day !
- Good vs Bad Leader
- C++EOF
- Good and Bad PHP Code
- good man or bad man?
- LightOJ 1051 Good or Bad
- LightOJ 1051 Good or Bad
- Good day and bad day
- Good News And Bad News
- bad-worse-worst VS good-better-best
- jquery在线手册,datatable(记录,防忘记)
- Linux rsync 同步大量文件及目录的处理
- 0910_vbs整理
- a
- 游戏服务器框架
- c++ good() eof() fail() bad()
- pl/sql 中文乱码问题
- MySQL 基本操作
- Very Deep Convolutional Networks for Large-Scale Image Recognition
- strlen与sizeof的区别
- android surfaceflinger研究----显示系统
- 43 Multiply Strings
- 正则表达式 中的特殊符号
- git 回退某个版本或者去掉某些patch