Can any one guide me how can i write a byte array to a file..
I am using ofstream class function write()..
but it only accepts char*, can any tell me some other function or any way of
conversion..ma code is:

Byte array[512];

//....the array is initialized using memcpy()....//

fstream ofs; 
ofs.open("FileData");
ofs.write(array,512);

I am using visual c++

Recommended Answers

All 2 Replies

typecast it ofs.write((char*)array,512);

Thanks It Worked...

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.