hello frndzz...
just wrote a piece of code in c++....bt this didnt create any .DAT file as expected.....dun knw wats wrng....

#include<fstream>
#include<iostream>
using namespace std;
class person
{
      int age;
      char name[40];
      public:
             void get()
             {
                  cout<<"enter age:";
                  cin>>age;
                  cout<<"enter name:";
                  cin>>name;
             }
             void show()
             {
                  cout<<"age is:"<<age<<endl;
                  cout<<"name is:"<<name<<endl;
             }
};
int main()
{
    fstream file;
    person pers;
    char ch;
    file.open("asssd.DAT",ios::app|ios::out|ios::in|ios::binary);
    do
    {
                pers.get();
                file.write(reinterpret_cast<char*>(&pers),sizeof(pers)); 
                cout<<"do another:";
                cin>>ch;                                             
    }while(ch=='y');

      system("pause");
    return 0;
}

Please use 'code' tags instead of 'program' tags.

Also, please use real words instead of "frndzz, bt, dun knw wats wrng".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.