2.00 2.50 2.50a 2.50b 2.60 | 2.50 2.50a 2.50b 2.60 3.00 | 2.50b MS-DOS | WINDOWS | MACINTOSH kbprg
FoxPro does not contain a function for replacing a character string in an ASCII text file. One way to do this is to use low-level file functions. A simpler way is to copy the text file to a memo field, make the change using STRTRAN(), and copy the memo field back to an ASCII file, as demonstrated below.
The following steps demonstrate this procedure:
- Create an ASCII text file that contains the following sentence: This sentence demonstrates how a character string can be changed.
- Create a database that contains only a memo field.
- Append a blank record to that database.
- Create a program that contains the following code.
APPEND MEMO <memofield> FROM <ASCII file> OVERWRITE
REPLACE <memofield> WITH Temp
COPY MEMO <memofield> TO <ASCII file>
- Run the program.
- Open the ASCII file; the word "demonstrates" should now read "shows".
Article ID: 113278 - Last Review: Jun 20, 2008 - Revision: 1