The best way I have found to do this is with the ShellExecute. It is simple to use and will open the text file in whatever program is set in the file association for .txt. Or whatever file type you give it.
I have used this quite a bit and it works great. It may look a little long and drawn out but is actually fairly simple. I usually will try to indicate the original author for this kind of thing but have had this for quite some time and don't remember where I got it exactly. May have been a combination of several places. You can do your error checking on lcCallStat if needed.
_____________________________________________
Procedure execpgm
* WinApi :: ShellExecute
** Function: Opens a file in the application that it's
** associated with.
** Pass: tcFileName - Name of the file to open
** tcWorkdir - Directory where the file is located
** tcOperation - what do you want done with the file? ('Open'
** is usually all you need.)
**
** Return: -1 - You Didn't send me a file name
** 2 - Bad Association (e.g., invalid URL)
** 31 - No application association
** 29 - Failure to load application
** 30 - Application is busy
**
** Values over 32 indicate success
** and return an instance handle for
** the application started (the browser)
** There is no error handling in this Code. This is left to the
** individual programmers.
LPARAMETERS tcFileName,tcWorkDir,tcOperation
LOCAL lcFileName,lcWorkDir,lcOperation, lnCallStat, lcMsgReply
lnCallStat = 0
lnMsgReply = 0
IF EMPTY(tcFileName)
RETURN -1
ENDIF
lcFileName=ALLTRIM(tcFileName)
lcWorkDir=IIF(TYPE("tcWorkDir"

="C",ALLTRIM(tcWorkDir),""

lcOperation=IIF(TYPE("tcOperation"

="C" AND NOT EMPTY(tcOperation),ALLTRIM(tcOperation),"Open"
*-* HINSTANCE ShellExecute(hwnd, lpszOp, lpszFile, lpszParams, lpszDir, wShowCmd)
*-*
*-* HWND hwnd - handle of parent window
*-* LPCTSTR lpszOp - address of string for operation to perform
*-* LPCTSTR lpszFile - address of string for filename
*-* LPTSTR lpszParams - address of string for executable-file parameters
*-* LPCTSTR lpszDir - address of string for default directory
*-* INT wShowCmd - whether file is shown when opened
DECLARE INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
lcCallStat = ShellExecute(0,lcOperation,lcFilename,"",lcWorkDir,1)