How to create a binary i/o file?

This program is supposed to ask the user if they want to open up an existing file, or create a new one. With an existing file, I have no problem, since it already exists. Creating a new one however, stumps me. My professor told me not to use a trick (before, I just opened a new file as an output file so it creates, then close it, and open it again in the proper mode), since I can't use that for this program, I'm at a loss of how to create a file and have it ready for binary file i/o without using any close and reopen tricks. Here's the relevant code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
                do 
		{

			cin.clear();
			cin.ignore();
			cout << "Enter the name of a new file: ";
			cin.getline(fname, 30);
			fio.open(fname, ios::out || ios::in || ios::binary || ios::trunc);
			if (!fio)
			{
				cout << "File does not exist, try again? (y/n) ";
				choice = getYesNo();
			}
		}
	while (choice == 'Y' && !fio);


I thought trunc would work (it wouldn't matter that it deletes that data since it's creating a file), but it still says file does not exist. I know you guys dislike homework problems, but the rest of the program is done (it's quite a big program with error checking and manipulating the file in many ways), this is just one little thing that is bugging me. Any help is appreciated.
Topic archived. No new replies allowed.