123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Program to find no. of Bytes in a text file.

--------------------------------------------------------------------------------

Description : This Program can be used to fine total no. of bytes in a text file.

#include<fstream.h>
#include<process.h>
#include<stdio.h>
#include<iostream.h>
#include<process.h>
#include<conio.h>
main()
{
clrscr();
int c=0;
char ch,file[30];
cout<<"Enter the name of the file:";
gets(file);
fstream f1;
f1.open(file,ios::in);
if(f1.bad())
{
cout<<"File can not be opened.";
exit(0);
}
if(f1.good())
{
cout<<"The current contents of the file are:
<BR>;
while(f1)
{
f1.get(ch);
c++;
cout<<ch;
}
}
cout<<"

Total no. of Bytes are "<<c;
f1.close();
cout<<"

Press Enter key to continue...";
getch();
return(0);
}

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG