Fall 1997 - Professor Fell
#include "SWindows.h" // set up for windows
#include "Graphics.h" // graphics functions & RGB definition
#include "RGBNames.h" // RGB names
#include "Random.h" // random numbers
#include "FileTool.h" // file tools
#include "Text.h" // fonts and text
#include "Delay.h" // delay controls
#include "SoundChannels.h" // play music
// volume 0 .. 255
// duration in half-milliseconds
// midiNote = midi # = 1 .. 127; middle C = 60
// prototypes
void main();
// definitions
void main()
{
// еее OPEN THE TEXT AND DRAWING WINDOWS:
BigWidePair();
// еее THE BODY OF THE MAIN FUNCTION
ifstream myFile;
string myFileName;
char ch;
/*----------------------------------------------------------------
myFile.open("data1.txt"); // straight C++
//while (myFile >> ch) cout << ch; // skips spaces
//while (myFile.get(ch)) cout << ch;
/*----------------------------------------------------------------
OpenFile(myFile, "data1.txt", textread); // from FileTools
//while (myFile >> ch) cout << ch; // skips spaces
//while (myFile.get(ch)) cout << ch;
/*----------------------------------------------------------------
SoundChannel A;
long notenum;
const short tempo = 2000;
short timer;
myFile.open("twinkle");
while (myFile >> timer >> notenum) A.Play(100, tempo/timer, notenum);
/*----------------------------------------------------------------
SelectOldFileName(myFileName);
//myFile.open(myFileName.c_str()); //NOT myFile.open(myFileName);
// or
//OpenFile(myFile, myFileName, textread);
//while (myFile >> ch) cout << ch; // skips spaces
//while (myFile.get(ch)) cout << ch;
/*----------------------------------------------------------------
if (SelectOldFileName(myFileName))
if (OpenFile(myFile, myFileName, textread)) {
while (myFile.get(ch)) {
cout << ch;
}
}
else << cout "error" << endl;
/*----------------------------------------------------------------
string FullName;
while (Confirm("Test Old File?", true)) {
if (SelectOldFileName(FullName))
while (myFile.get(ch)) {
cout << ch;
}
else
cout << "еее Cancel еее" << endl;
cout << endl;
}
while (Confirm("Test New File?", true)) {
if (SelectNewFileName(FullName,"Junk"))
cout << FullName << endl;
else
cout << "еее Cancel еее" << endl;
cout << endl;
}
*/
// еее THAT'S IT еее QUIT WHEN USER HITS RETURN
//PressReturn("Terminating Program");
}
Last Updated: November 11, 1997 10:31 pm by
Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is:
http://www.ccs.neu.edu/home/fell/COM1100/Docs/FileTest.html