ਫ 8.  ⮪ -뢮  ++


  ⮪  -뢮     ꥪ⭮-ਥ-
஢ ⮬ ⠭⭮  ⥪  -뢮
(stdio). 

1.  ⮪ -뢮

ios		-  ⮪ 
streambuf	- ਧ ⮪
istream		- ⮪ 
ostream		- ⮪ 뢮
iostream	- 㭠ࠢ ⮪
iostream_withassign
		- ⮪  ८। 樥
		  ᢠ
istrstream	- ப ⮪ 
ostrstream	- ப ⮪ 뢮
strstream	- 㭠ࠢ ப ⮪
ifstream	- 䠩 ⮪ 
ofstream	- 䠩 ⮪ 뢮
fstream		- 㭠ࠢ 䠩 ⮪

⠭ ⮪ (istream,ostream,iostream) -  ࠡ
 ନ.

ப ⮪ (istrstream, ostrstream, strstream) -
 -뢮  ப ஢, ࠧ饭 
. 

 ⮪ (ifstream, ofstream, fstream) -  ࠡ
 䠩.

2.  䠩.

#include <iostream.h>	// ⠭ ⮪ -뢮:
			// ios,istream,ostream,iostream
#include <fstream.h>	//  ⮪ -뢮:
			// ifstream,ofstream,fstream
#include <iomanip.h>	// 
#include <strstream.h>	//  ⮪ -뢮:
			// istrstream,ostrstream,strstream

3. ।। ꥪ-⮪.

騥 ⮪ ࠭ ।    ணࠬ
। 맮 㭪樨 main:

extern	istream	cin;	// ⠭ ⮪  
			//  
extern	ostream	cout;	// ⠭ ⮪ y 
			//  ࠭
extern	ostream	cerr;	// ⠭ ⮪ 뢮 
			// ᮮ饭  訡
			// (࠭)
extern	ostream	cerr;	// ⠭ ਧ ⮪
			// 뢮 ᮮ饭  訡
			// (࠭)

4. ८। 樨 ⥭-  
⨯ 

 ⮪ ८। 樨 >> ()    <<  (뢮)
     㣨  ⨯  .  -뢮
⢫    ८ࠧ  ७   (筮)
 ।⠢   (ᨬ).

ostream	&operator<<(char);
ostream	&operator<<(int);
ostream	&operator<<(long);
...
ostream	&operator<<(char*);
...
istream	&operator>>(char&);	
istream	&operator>>(int&);
istream	&operator>>(long&);
...

 ।  ᯮ짮 楯窨 権

int	n;
double	d;
cout << "n=" << n << " d=" << d << "\n";
cin  >> n >> d;


5. ८। 権 ⥭-  ⨯
 짮⥫

#include <iostream.h>

class	myclass
	{
	int	d1,d2;
	...
public:
friend	istream& operator>>(istream&, myclass&);
friend	ostream& operator<<(ostream&, myclass&);
	...
	};

istream& operator>>(istream &STR, myclass &DAT)
{
STR >> DAT.d1 >> DAT.d2;
return(STR);
}

ostream& operator<<(ostream &STR, myclass &DAT)
{
STR << "d1=" << DAT.d1 << " d2=" << DAT.d2 << "\n";
return(STR);
}

6. ଠ஢   ⮪

 ଠ஢ - ⮢   ६ ⨯ long

enum	ios::io_format
	{
skipws	=	0x0001,	// ஢ ஡  
left	=	0x0002,	// ࠢ   ࠭ 
right	=	0x0004,	// ࠢ  ࠢ ࠭ 
internal=	0x0008,	//  뢮    ,
			// ᠬ ᫮ ࠢ  ࠢ
dec	=	0x0010,	// 筠 ⥬ ᫥
oct	=	0x0020,	// 쬥筠 ⥬ ᫥
hex	=	0x0040,	// ⠭筠 ⥬ ᫥
showbase=	0x0080,	// 뢮  ⥬ ᫥
			// (0...  0x...) 
showpoint=	0x0100,	// 易⥫ 뢮 筮 窨
uppercase=	0x0200,	// 孨 ॣ ᨬ:
			// 0X00FF, 0.5E2
showpos	=	0x0400,	// 易⥫ 뢮 "+"
scientific=	0x0800,	// 易⥫ 뢮 浪 ᫠
fixed	=	0x1000,	// 뢮  䨪஢ 窮 nnn.mmm
unitbuf	=	0x2000,	// ⪠  ᫥  뢮
stdio	=	0x4000	// ⪠ ⮪ stdout, stderr 
			// ᫥  뢮 (flush)
	};		

㭪樨 ଠ஢   ios

long	flags();	// ⥭ 䫠 ଠ஢
long	flags(long);	// ᢠ 䫠 ଠ஢
			// (㫥  )
			// (頥  祭 䫠)
long	setf(long);	// ⠭ 䫠 ଠ஢
			// (⠭  ᪥  1)
long	unsetf(long);	//  䫠 ଠ஢
			// (⠭  ᪥  1)
long	setf(long,long);// ⠭ 䫠 ଠ஢
			//  ࢮ ࠬ  ᪥
			// ண ࠬ
char	fill();		// ⥭ ᨬ  (஡)
char	fill(char);	// ⠮ ᨬ 
int	precision();	// ⥭ 筮 ।⠢
			// float  double
int	precision(int);	// ⠭ 筮 ।⠢
int	width();	// ⥭ ⥪饩 ਭ 
int	width(int);	// ⠭ ⥪饩 ਭ 
static	long bitalloc();// ⥭ ᪨ 䫠

7. 

 - 㭪樨 ⮪,    
樨 饭  祭  ⮪ ( <<, >>).

endl		// 饭  室 ⮪ ᨬ
		//  ப '\n'  맮 㭪樨 flush
ends		// 饭  室 ⮪ ᨬ '\0'

flush		// 맮 㭪樨 뢮 ਧ 
		//  室 ⮪
dec		// ⠭ ᭮ 10 ⥬ ᫥

hex		// ⠭ ᭮ 16 ⥬ ᫥

oct		// ⠭ ᭮  8 ⥬ ᫥

ws		// ⠭ ஢   ஡

setbase(int)	// ⠭ ᭮ ⥬ ᫥
		// (0 - 10 -  㬮砭, ⠪ 8,10,16)
resetiosflasg(long)
		//  䫠 ଠ஢  ᪥
setiosflags(long)
		// ⠭ 䫠 ଠ஢  ᪥
setfill(int)	// ⠭ 饣 ᨬ

setprecision(int)
		// ⠭ 筮 뢮 ⢥ 
		// ᥫ
setw(int)	// ⠭ ਭ  -뢮

ਬ 맮 :

cout << 15 << hex << 15 << setbase(8) << 15;


8. ﭨ ⮪

ﭨ ⮪ ࠪਧ  ⮬    state,
 ண । 䫠 ﭨ  㭪樨 ࠢ
ﭨ.

enum	ios::io_state
	{
goodbit	=	0x00,	// 訡 
eofbit	=	0x01,	// 㦥 ਧ  䠩
failbit	=	0x02,	// 訡 ଠ஢ 
			// ८ࠧ 
badbit	=	0x04,	// 쥧 訡 (ਧ,
			// ⥭ ᫥  䠩  ..)
hardfail=	0x08	// ⭠ 訡
	};

㭪樨 ࠢ ﭨ   ios

int	rdstate();	// ⥭ ⥪饣 ﭨ
int	eof();		// ஢ઠ 䫠 eof
int	fail();		// ஢ઠ badbit | failbit | hardfail
int	bad();		// ஢ઠ badbit | hardfail
int	good();		// ஢ઠ  ⢨ 訡
int	clear(int=0);	// ⠭ 䫠 訡, 
			// 㬮砭 - ⪠ 
operator void*();	// ८ࠧ  ⨯ void*,
			// 頥 NULL, ᫨ fail()==1
int	operator!();	// 頥 1, ᫨ fail()==1


᫥ ८।  ஢ 稥 訡 
 ⮪  

if (cout) ...		if (!cout) ...

9.  ⮪

 䠩 ⮪

ifstream	- 䠩 , ந  istream
ofstream	- 䠩 뢮, ந  ostream
fstream		- 䠩 -뢮, ந  iostream

 ० ࠡ  䠩

enum	ios::open_mode
	{
in =	0x01,	//  䠩 ⮫쪮  ⥭
out =	0x02,	//  䠩 ⮫쪮  
ate =	0x04,	//  ⨨ 樮஢   䠩 
app =	0x08,	//  騩  
trunc =	0x10,	//   䠩  饣 
nocreate=0x20,	//  ᮧ  䠩   ⢨
noreplace=0x40,	//  ᮧ  䠩, ᫨  
binary=	0x80	//  䠩 ("஧" -뢮 
		// ८ࠧ ᨬ  ப)
	};


 ꥪ⮢ ( ᮢ ifstream,ofstream,fstream)
 㭪樨 / 䠩 

ifstream();		//   䠩
...
ifstream( 		//  ⨥ 䠩   
	char *name, 	// ० imode
	int imode=ios::in, 
	int prot=filebuf::openprot);
...
ifstream(int fd);	//  ᮥ 䠩  ਯ-
			// ஬ fd
...
ifstream(		//  ,    ஬
	int fd, 
	char *buf, int sz);
...
void	ifstream::open( 	
	char *name,	// ⨥ 䠩   ० 
	int imode=ios::in, 
	int prot=filebuf::openprot);
...
void	close();	//  䠩
void	setbuf(
	char *p,int sz);// ⠭  ⮪
int	fd();		// ਯ ⮣  ⮪ 䠩
int	is_rtl_open();	// 1 - 䠩   ⮪

᫥ ८। ஢  ஢
稥 訡  ⮪  

fstream	ss;

if (ss) ...		if (!ss) ...



㭪樨 -뢮  䠩 ⮪
(㭠᫥  istream,ostream  iostream)

// ⥭ 㪠 ⢠ ᨬ (⮢)
//  ⮪  
istream& read(		char *p, int n);
istream& read(   signed	char *p, int n);
istream& read( unsigned	char *p, int n);

//  㪠 ⢠ ᨬ (⮢)
//    ⮪
ostream& write(		char *p, int n);
ostream& write(  signed	char *p, int n);
ostream& write(unsigned	char *p, int n);

// ⥭- ᨬ  ⮪
istream& get(		char &p);
istream& get(   signed	char &p);
istream& get( unsigned	char &p);
ostream& put( char c);

// ⥭ ப  ⮪ (n-, c-࠭⥫,
//  ⮪  )
istream& get(char *p, int n, char c='\n');

// ⥭ ப  ⮪ (n-, c-࠭⥫,
//  ⮪ ,    )
istream& getline(char *p, int n, char c='\n');

// ய n ᨬ   (c - ࠭⥫, 
//   ⮪)
istream& ignore(int n=1, int d=EOF);

// ᫮ ᨬ, ⠭ ᫥ 㭪樥
// ଠ஢ 
int	gcount();

// ⥭ ᨬ  祭  ⮪
int	peek();

// 饭 ᨬ  室 ⮪
istream& putback(char c);

// 樮஢  ⮪  ⥭ ⥪饩 樨

enum	ios::seek_dir
	{
	beg = 0,	//  砫 䠩
	cur = 1,	//  ⥪饩 樨
	end = 2		//   䠩
	};

typedef	long	streampos;
typedef	long	streamoff; 

istream& seekg(streampos);
istream& seekg(streamoff, ios::seek_dir);
ostream& seekp(streampos);
ostream& seekp(streamoff, ios::seek_dir);
streampos istream::tellg();
streampos ostream::tellp();

10. ப ⮪

ப ⮪ - ⮪, 筨 ᨬ 
  䠩,  ப  .  ᫥ 
㭪樨  樨 istream, ostream  iostream.

 ப ⮪ (p -  ப, n - ,
mode - ० )

istrstream(char *p);
ostrstream(char *p, int n, int mode);
// mode = ios::out -   砫 ப
// mode = ios::ate -   饩 ப
strstream (char *p, int n, int mode);
// ios::in - ⥭ ப
// ios::out -  ப
// ios::ate -   饩 ப
// 㭪 seekg - 樮஢  ப

