/* Data was not inserted into the file what is the problem idon't no can any one solve this problem*/
#include<iostream> #include <fstream> using namespace std; typedef struct transaction { char data[100]; char *txnName=data; long amount; char pan[100]; char *PAN=pan; public:void TrDetails() { std::cout<<"Enter Name:"; std::cin>>data; std::cout<<"Enter the amount:"; std::cin>>amount; std::cout<<"Enter the Pan No:"; std::cin>>pan; std::cout<<"Entered Details are:"<<std::endl<<data<<std::endl<<amount<<std::endl<<pan; } }; int main() { transaction TXN_RECORD; TXN_RECORD.TrDetails(); fstream file("Tranx1.dat",ios::app|ios::out|ios::binary); file.open("Tranx1.dat",ios::app|ios::out|ios::binary); file.write((char *)&TXN_RECORD,sizeof(TXN_RECORD)); ofstream of; std::cout<<"Inserted Data Succ"; cin.getline(TXN_RECORD.data, 100); of<<TXN_RECORD.data; file.close(); }