Tài liệu lập trình C tiếng Việt lesson 8 IOS

20 418 0
Tài liệu lập trình C tiếng Việt lesson 8 IOS

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Lập trình hướng đối tượng Bài 8: Kênh I/O Nội dung Giới thiệu Vào chuẩn Vào file Giới thiệu IO header, template, class Template    template class basic_istream; template class basic_ostream; charT: char, wchar_t, char16_t, char32_t Template Instantiations typedef           typedef basic_ios ios; typedef basic_ios wios; typedef basic_istream istream; typedef basic_istream wistream; typedef basic_ostream ostream; typedef basic_ostream wostream; typedef basic_iostream iostream; typedef basic_iostream wiostream; typedef basic_streambuf streambuf; typedef basic_streambuf wstreambuf; Các đối tượng toàn cục cin/wcin  cout/wcout  cerr/wcerr  clog/wclog Toán tử  >>  [...]... read() // ostream class ostream & write (const char * buf, streamsize n) // Write n character from char array Other istream functions - peek() and putback() char peek //returns istream & // insert (); the next character in the input buffer without extracting it putback (char c) ; the character back to the input buffer 11 Trạng thái c a luồng eofbit  failbit  badbit  goodbit Public functions:  good()... output #include ofstream fout; fout.open(filename, mode); fout.close(); // OR combine declaration and open() ofstream fout(filename, mode); void open (const char* filename, ios: :openmode mode = ios: :in | ios: :out); // open() accepts only C- string For string object, need to use c_ str() to get the C- string void close (); // Closes the file, flush the buffer and disconnect from stream object bool... badbit  goodbit Public functions:  good()  eof()  fail()  bad()  clear()  12 Định dạng vào ra nhờ t c tử   header: setw(), setprecision(), setbase(), setfill() header: fixed|scientific, left|right| internal, boolalpha|noboolalpha 13 Định dạng ra m c định cout cout cout cout cout cout cout cout cout cout cout cout ... basic_iostream wiostream; typedef basic_streambuf streambuf; typedef basic_streambuf wstreambuf; C c đối tượng toàn c c cin/wcin  cout/wcout  cerr/wcerr  clog/wclog... char_traits > class basic_ostream; charT: char, wchar_t, char16_t, char32_t Template Instantiations typedef           typedef basic _ios< char> ios; typedef basic _ios< wchar_t> wios; typedef... Vào chuẩn Vào file Giới thiệu IO header, template, class Template    template class basic_istream; template

Ngày đăng: 28/03/2016, 01:06

Mục lục

  • Lập trình hướng đối tượng

  • IO header, template, class

  • Các đối tượng toàn cục

  • Các hàm vào ra không định dạng

  • read(), write() và gcount()

  • Trạng thái của luồng

  • Định dạng vào ra nhờ tác tử

  • Định dạng ra mặc định

  • Field Width (setw), Fill Character (setfill) and Alignment (left|right|internal)

  • Floating-point Format (fixed|scientific) và Precision (setprecision)

  • Integral Number Base (dec|oct|hex, setbase)

Tài liệu cùng người dùng

Tài liệu liên quan