Member Avatar

Please find and correct the error in my c++ program. "Linker Error: Undefined symbol _main in module c0.ASM" The program is for transfering content of one file to another. #include<fstream.h> #include<iostream.h> #include<conio.h> class student { int rollno; char name[20]; int tm; public: void input(); void transfer(); void output(); } obj; void student::input() { char ch='y'; ofstream outf; outf.open("mark.dat"); while(ch=='y') { cout<<"Enter rollno, name and mark"; cin>>rollno>>name>>tm; outf.write((char*)&obj,sizeof(obj)); cout<<"wish to enter more(Y/N)"; cin>>ch; } outf.close(); } void student::transfer() { ofstream outf; ifstream inf; inf.open("mark.dat"); inf.open("trans.dat"); while(inf) { inf.read((char*)&obj,sizeof(obj)); outf.write((char*)&obj,sizeof(obj)); } outf.close(); inf.close(); } void student::output() { ifstream inf; inf.open("trans.dat"); while(inf) { …

Member Avatar
0
19
Member Avatar

Please correct the error in my program. When i run the program on turbo c++ 3, it output 3 times. Also When i enter more than 1 entry only the last entry is outputted. Also it is outputted 3 times. [CODE]#include<fstream.h> #include<iostream.h> #include<conio.h> class student { int rollno; char name[20]; int tm; public: void input(); void transfer(); void output(); } obj; void student::input() { char ch='y'; ofstream outf; outf.open("mark.dat"); while(ch=='y') { cout<<"Enter rollno, name and mark"; cin>>rollno>>name>>tm; outf.write((char*)&obj,sizeof(obj)); cout<<"Wish to enter more(Y/N)?\n"; cin>>ch; } outf.close(); } void student::transfer() { ofstream outf; ifstream inf; inf.open("mark.dat"); outf.open("trans.dat"); while(inf) { inf.read((char*)&obj,sizeof(obj)); outf.write((char*)&obj,sizeof(obj)); } …

Member Avatar
0
6
Member Avatar

Hy, I am trying to encode an X509 certificate into base64, and since the encoder I'm using takes only char*, and typecasting doesn't work, i find a different way to do this. I'm sure there is a simpler way, but i just can't find it. Here is the code: [CODE]BUF_MEM *bptr; BIO* mem = BIO_new(BIO_s_mem()); PEM_write_bio_X509(mem, x509p); int i = BIO_get_mem_data(mem, &bptr); _TCHAR* tmp = new _TCHAR( i+1 ); memcpy(tmp, bptr, i); tmp[ i ] = _T('\0'); BIO_free_all(mem); X509_free(x509p);[/CODE] The whole thing works "fine", but after this part every "new" object i create fails, and throws an [B]std::bad_alloc[/B] exception. (I …

Member Avatar
0
3

The End.