📄 fortune.txt
字号:
************************************************************************
The Fortune Cookie program for DOS AND WINDOWS
by Matthew J. W. Ratcliff
Ratware Softworks
(c) Wed 07-13-1994 08:59:13
All source code may be used without any restrictions except the
following:
All code written by the author, Matthew J. W. Ratcliff,
shall retain credits to the author in the source code
comments as its original creator.
This software is presented "as-is". Its applicability to
the end users' needs is up to the end user dude or
dudette.
******** USER GUIDE ****************************************************
Fortune.exe
This is the fortune cookie program for EITHER DOS or Windows 3.1
(tm).
Run from the DOS command line and get something like this:
C:\>FORTUNE
Honerable fortune cookie #1654 says...
------------------------------------------------------------
The objective of all dedicated employees should be to thoroughly
analyze all situations, anticipate all problems prior to their
occurrence, have answers for these problems, and move swiftly to solve
these problems when called upon.
However, When you are up to your ass in alligators it is difficult to
remind yourself your initial objective was to drain the swamp.
------------------------------------------------------------
<< WINDOWS >>
If you install this program as an ICON in Windows you'll get a
"Popeye" (as in the sailor man) ICON. Double click on this icon
and you'll receive similar pearls of wisdom in a dialog box.
Something like this:
+--------------------------------------------------------++
| Honerable fortune cookie #1673 says... ||
| I do not know myself, and God forbid that I should. ||
| -- Johann Wolfgang von Goethe ||
| ||
| ||
| ||
+--------------------------------------------------------++
[Cut to Clipboard...] [Again, Again...] {Popeye} [Ahh So..]
Move the mouse pointer to the "Cut to Clipboard" and click the
left mouse button. The program will then "cut" this fortune
cookie to the Windows clipboard buffer. Go to your windows
application and press "shift insert" to insert the timeless tomes
into your document. Click on "Again, Again" to see another pearl
of wisdom, randomly selected from the database file FORTUNE.DAT.
Click on the "Ahh So" button to leave the program and return to
your normal duties.
If you want to make a copy of this program for your personal use
at home or on any other computer, simply copy these files:
FORTUNE.EXE
FORTUNE.DAT
(optional)
FORTUNE.TXT (this file)
So long as FORTUNE.DAT is in the same directory as FORTUNE.EXE,
or if FORTUNE.DAT is in any subdirectory in your system search
path, FORTUNE.EXE will find the data file.
This program was written to test some new file processing
algorithms. Because the program is "somewhat" useful (if nothing
else, it might cheer you up a bit?), I thought I'd release it to
other users in the system.
Mat*Rat
******** PROGRAMMER GUIDE **********************************************
This application is setup to be built from BORLAND C++ For
Windows and DOS. (You must build a DOS version first. The DOS
code is linked in with the Windows code to give you two- two-
two-programs in one!) The code uses standard Windows API calls.
It does not depend on OWL (Borland's Object Windows Library) nor
MFC (Microsoft Visual C++'s Microsoft Foundation Classes).
Some of the nifty things you can learn from this application:
o How to create a program that is mostly "mindless
drivel", but is still FUN to use. <grin>
o How to write a single program that works for BOTH DOS
and Windows with MINIMAL EFFORT!
o How to build a DIALOG BOX ONLY application. (Note some
of the styles defined for the dialog in the .RC file.
These are necessary for the dialog to come up properly as
an application's main window.)
o How to write PRETTY CODE. Hey, I'm a verbose kind of
guy. You'll find more documentation in my source code
than most companies put in their published documentation.
This code is highly reusable from either DOS or Windows.
o How to build INFINITE LINKED LISTS. The linked list
classes that come with Microsoft (and Borland?) compilers
have inherent limitations (such as a maximum number of
entries). Mine do not - so long as you have memory, you
can add to your list. I have two generic linked list
classes, MMUllist and MMUvlist. A linked list class of
standard null-terminated C strings is implemented as
MMUslist, a subclass of MMUllist. These linked list
classes have been used extensively in over 150,000 lines
of my own Windows and DOS applications - to gain instant
access to as much as 14 megabytes of data! - with no
problems! Don't use anyone elses doubly linked lists!
o File support. Look at FIUFILE.H. It can find files
for you. It can give you directory listings, with or
without a full path to each file. It can check if a path
exists. Lots more. Also, these functions are "network
aware" and "network friendly". If you attempt find a
file that is already open by another user on the network
server, the method FIUFILE implements will find the file
without causing anyone any headaches. It compiles under
EITHER Borland or Microsoft. FIUFILE.DOC is a Word For
Windows (6.0 format) "User Manual" for FIUFILE.H/.CPP.
o String procesing. Look at LIUSTRG.H. It has all sorts
of nifty string processing functions, including LIUxxx
versions of all the standard string functions. (I've
used it extensively over the years for porting string
processing to embedded systems that had no support for
these.)
o Error handling. ERAPRPT.H provides prototypes for a
standard method for error reporting. The interface to the
error handling functions is a "printf" format, so they're
incredibly easy to use. ERAPPRTF.CPP is a "printf"
version of error reporting for DOS. "ERAWIN.CPP" is a
"message box" version of error reporting for windows.
Thus, the "users" of the ERAxxx error logging functions
don't care (nor need to know) what the user interface is
(DOS printf or Windows message box), so that any code
detecting an error can use ERAxxx to report it
(especially code where "user interface" doesn't belong
like FILE and STRING processing.)
*** TO COMPILE ***
UNZIP all these files to a common directory. Fire up Borland C++
for Windows (version 3.1. For later versions you might have to
"convert" your project file to a make file. The make file for
Borland, my setup, is included in the archive too, FORTBCW.MAK
and FORTDOS.MAK). Off this directory (say C:\FORTUNE, for
example) create two more directories DOS and WIN. You should have
all source and include files in C:\FORTUNE. When you build the
DOS version of the program, all DOS object files and the DOS
executable, FORTDOS.EXE, will go in C:\FORTUNE\DOS. When you bild
the Windows version of the program, all Windows object files and
the Windows executable, FORTBCW.EXE, will go in the
C:\FORTUNE\WIN directory.
Copy FORTUNE.DAT into your BATCH or UTIL or some other
subdirectory that is in your system search path.
******** CONSTRUCTION PROCESS ******************************************
Fire up Borland C/C++ IDE for DOS. Load FORTDOS.PRJ. BUILD ALL.
Exit to DOS. Go to the FORTUNE\DOS directory. Execute
FORTDOS.EXE. You should get a nifty forutne cookie.
Next, fire up Windows. Fire up Borland C++ for Windows. Load
FORTBCW.PRJ. BUILD ALL. It should locate FORTDOS.EXE in your
FORTUNE\DOS directory and link it in with FORTBCW.EXE. Execute
FORTBCW.EXE. You should get a purdy dialog box with a nifty
fortune cookie init.
Next, rename FORTBCW.EXE to FORTUNE.EXE. Move FORTUNE.EXE to
your UTIL or WINDOWS\UTIL or whatever directory you prefer. Next
select FILE | NEW from your Windows PROGRAM MANAGER. BROWSE to
find FORTUNE.EXE and add this icon to the desired group in your
windows environment. (Put it in the STARTUP group if you want to
see a Pearl-O-Wisdom each time you run Windows.)
******** FILE DESCRIPTIONS *********************************************
The SOURCE and INCLUDE files in this archive are as follows:
ERAPPRTF CPP 18043 - DOS based error logger
ERAWIN CPP 21766 - Windows based error logger
FIUFILE CPP 55549 - FIUxxx file functions
FIUFIND CPP 19314 - More FIUxxx file functions related to
"finding" things
FORTDOS CPP 5697 - Fortune Cookie DOS program
FORTUNE CPP 11340 - Fortune Cookie CLASS. DOS or Windows
compatible
FORTUNEW CPP 10207 - Fortune Cookie Windows program
LIUSTRG CPP 65878 - String processing utilities
MMULIST CPP 76411 - Linked list processing class
MMUSLIST CPP 27591 - String linked list subclass
ERAPDEFS H 3309 - Public error logger definitions
ERAPRPT H 2932 - Error logger prototypes
ERAPRPTW H 482 - One Windows specific error logger
prototype
ERPDRPT H 208 - Error logger prototypes
FIGFILE H 1993 - Constants "private" to the FIUxxx.CPP
No other .CPP files should include it.
FIPFILE H 2258 - PUBLIC constants related to file
processing
FIUFILE H 12534 - Prototypes to FIUxxx file processing
FORTUNE H 2612 - Fortune cookie class definition
LIIDSYS H 5292 - System constants and data types
LIUSTRG H 5819 - String procesing prototypes
MMGLIST H 1686 - Constants "private" to MMUxxx.CPP
No other .CPP files should include it.
MMPLIST H 1951 - Public linked list constants.
MMULIST H 16773 - Linked list class definition
MMUSLIST H 5679 - Linked list of strings class definition
******** WINDOWS SUPPORT FILES *****************************************
FORTUNE DEF 277 - Windows DEF file for Fortune cookie.
Note that FORTDOS.EXE is specified as
the "STUB" instead of "WINSTUB.EXE".
FORTUNE RC 2108 - Dialog box resource for Fortune Cookie
for Windows.
FORTUNE ICO 766 - Fortune cookie for Windows application ICON
RESOURCE H 377 - Resource constants for Windows fortune
cookie program
******** PROGRAM AND DATA FILES ****************************************
The final executable (after building FORTDOS.EXE, FORTBCW.EXE and
renaming FORTBCW to FORTUNE):
FORTUNE EXE 90624 - Fortune Cookie for DOS and Windows
FORTUNE DAT 348056 - Fortune Cookie database. Put it in
any directory in your system search
path, or in the same directory as
FORTUNE.EXE, and the program WILL
FIND IT!
******** MAKE FILES ****************************************************
If you have a newer (older) version of Borland C++ than 3.1, then
have a look at these MAKE FILES. The .PRJ (project) files are
specific to 3.1. These make files, however, should be compatible
with more versions of Borland (or easily adapted to).
If you're using Microsoft or some other brand of Windows capable
compiler, these make files will tell you how to setup the build
process for this program in your compiler environment.
FORTBCW MAK 1801 07-13-94 8:47a
FORTDOS MAK 1582 07-13-94 8:48a
******** DOCUMENTATION *************************************************
FIUFILE DOC 35328 - Word for Windows 6.0 format complete
documentation for FIUFILE.CPP, file
utilities.
FORTUNE TXT 11942 - This file.
Presented by:
+-----------------------------------------+
| Matthew J. W. Ratcliff |
| Ratware Softworks |
| (c) 1994 |
| Free reuse by end user so long as |
| credits are given to original author. |
+-----------------------------------------+
| How to contact the author: |
| GEnie: MAT.RAT |
| CompuServe: 72154,403 |
| Address: P. O. Box 295 |
| Villa Ridge, MO 63089 |
+-----------------------------------------+
Wed 07-13-1994 08:59:03
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -