How to open binary file

Hello here is my code: i am pretty sure it runs fine but since i have the microsoft visual express c++ when i go to the c drive it wont let me open the critters.bin file....is there any way i can open the file and see its contents?

#include <iostream>
#include <string>
#include "Cat.h"
#include <fstream>
using namespace std;



int main()
{
Cat yourCat;
int num = 3;

fstream file;
cout << "Enter 3 cat records.\n";

file.open("c:\\critters.bin", ios::out | ios::binary);

for(int i = 0; i < 3; i++)
{
cout << "Enter information about a cat:\n";
cout << "NAME: ";
cin >> yourCat.name;
cout << "AGE: ";
cin >> yourCat.age;
file.write(reinterpret_cast<char*>(&yourCat), sizeof(Cat));
}


while(file >> num)
{
file.write(reinterpret_cast<char*>(&yourCat), sizeof(Cat));
}
cout << "Record written to file.\n";



system("pause");
return 0;
}

///header

struct Cat
{
char name[20];
int age;


};
How are you trying to open the file? Just by double-clicking the icon?
Yes and I also tried "choose a program " or open with. I've tried Microsoft visual studio selector ...notepad...and doesn't work
The file is binary. You need a hex editor to read it properly, otherwise you'll just see garbage.
Thank you ...ive downloaded a hex editor and seems to work.....nowcan you please tell me if my program does what it suppose to which is:
takes in 3 records of a cats name and age. then saves it to the bin file
Topic archived. No new replies allowed.