<aside> ๐ก
jText
๋ชฉ์ : ๋ฌธ์์ ๋ฌธ์์ด์ ๋ค๋ฃธ
ํน์ง: cpp-std-stl ๊ธฐ๋ฐ์ผ๋ก ์ฑ๋ฅ๊ณผ ํธ์์ฑ์ ์ถ๊ตฌ
์คํธ๋ฆผ
| ์ต์์
| std::ios <ios> | ์ ๋ ฅ ์คํธ๋ฆผ i | ์ถ๋ ฅ ์คํธ๋ฆผ o | ์ ์ถ๋ ฅ ๊ณตํต |
|---|---|---|---|
| ๊ณตํต์ ์ถ๋ ฅ | |||
| <iostream> | std::istream | std::ostream | - |
| ํ์ผ | |||
| <fstream> | std::ifstream | std::ofstream | std::fstream |
| ๋ฌธ์์ด | |||
| <sstream> | std::istringstream | std::ostringstream | std::stringstream |
| ํ์ค | std::cin | std::cout | |
| std::cerr | |||
| std::clog | - | ||
| ๋ง์นจ/๋ฒํผ | std::ws | std::endl | |
| std::flush | - | ||
| ์๋ฒ ๋๋/๋คํธ์ํฌ | |||
| (๋นํ์ค, 11๋ถํฐ ์ ๊ฑฐ) | std::istrstream | std::ostrstream | std::strstream |
์คํธ๋ฆผ๋ฒํผ (๋ณ๋์ ํด๋์ค std::streambuf) โ rdbuf() { โฆ } โ std::streambuf
char buf[8192]; // ์คํธ๋ฆผ์ด ๋ซํ๋๊น์ง ์ ํจํด์ผํจ
std::ifstream ifstm;
ifstm.open(filename);
ifstm.rdbuf->pubsetbuf(buf, sizeof(buf)); // (๋ฒํผ๊ฐ์ฒด, ํฌ๊ธฐ)
// 8KB ์ด์์ ๋ฒํผ์ด๋ฉด ์ฑ๋ฅํฅ์ํจ๊ณผ ํฌ์ง์์
์ฌ์ฉ: java, cpp, cs ๋์์ ๋ชฉํ๋ก ํจ </aside>
#define _LONGLONG long long; // yvals.h -> for MSVC COMPILER PARAMETERS
typedef _LONGLONG _Longlong; // yvals.h -> for MSVC STD ๋น๋๊ด๋ จ๋ฌธ์ (ํ๋ซํผ ์ ์๋ฑ)
typedef _Longlong streamoff; // iosfwd -> for STD ์ ๋ฐฉ์ ์ธ๋ฌธ์
typedef _Longlong streamsize;
std::streamoff SizeCurToEnd(std::istream istm)
{
std::istream::pos_type cur_pos istm.tellg(); // ๋ชป์ฐพ์ผ๋ฉด -1๋ฐํ
if (-1 == cur_pos) return -1;
istm.seekg(0, std::istream::end);
std::istream::pos_type end_pos = istm.tellg();
istm.seekg(cur_pos);
return end_pos - cur_pos;
}