Tweet
/* Program to print ASCII Values using put() */
#include<fstream.h>
#include<conio.h>
void main()
{
ofstream fout;
fout.open("ASCIIChars",ios::app);
if(!fout)
{
cout<<"The file cannot be opened ...\n";
return;
}
char ch;
int line=0;
for(int i=33;i<128;i++)
fout.put((char)i);
fout.close();
ifstream fin;
fin.open("ASCIIChars",ios::in);
fin.seekg(0);
for(i=33;i<128;i++)
{
fin.get(ch);
cout<<" "<<i<<" = ";
cout.put((char)i);
if(!(i%8))
cout<<endl<<line++;
if(line>22)
{
getch();
line=0;
}
}
}
File Handling in C++
Posted by
LAHAUL SETH
~
File Handling in C++
2011-12-07T09:29:00+05:30
LAHAUL SETH
C++
|
cplusplus
|
Comments
File Handling in C++
2011-12-07T09:29:00+05:30
LAHAUL SETH
C++
|
cplusplus
|