CODE
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#include<stdio.h>
class router
{
char str[20],*p;
public:void pkt_type(fstream &file) :angry:
{
file.seekg(0);
file.getline(str,20);[b][color=#FF0000]//str is NULL why [/b][/color]
p=strchr(str,'0');
cout<<endl<<endl<<"\t" <<str<<endl;
if(p)
{
cout<<endl<<" Data Packet Found ";
}
else
{
cout<<endl<<" Marking Packet Found ";
}
}
};
void main()
{
fstream file;
file.open("maza",ios::in|ios::out|ios::trunc);
char src[20],des[20],data[100],temp[100];
clrscr();
cout<<" Enter the source address ";
cin.getline(src,20);
cout<<"\n Enter the destination address ";
cin.getline(des,20);
cout<<"\n Enter the data ";
cin.getline(data,100);
file<<" DF:0\n";
file<<" Uflag :0\n";
file<<" Source :"<<src<<"\n";
file<<" Destination :"<<des<<"\n";
file<<" Data :"<<data;
file.seekg(0);
cout<<endl<<endl;
while(!file.eof())
{
file.getline(temp,100);
cout<<temp<<endl;
}
router r;
r.pkt_type(file);
file.close();
getch();
}
file variable received in router class function pkt_type shows no value i tried to print the contents of file using while like in main but no result