 |
| PocketPC: creating directories and files |
User rating: 0/10 (0 votes) | | |
|
 |
 |
| Before you begin: |
 |
This example shows how to create directories and files on Windows CE device connected to computer through ActiveSync connection.
Methods of the base class StringToFile and FileToString have similar interface with STRTOFILE and FILETOSTR functions in FoxPro.
The code is based on custom RAPI class. Download the class module first and save it in clsRapiFiles.prg file. |
 |
 |
#DEFINE CRLF CHR(13)+CHR(10)
SET PROCEDURE TO clsRapiFiles ADDITIVE
LOCAL rapi As Trapi, oFiles As Tfiles
rapi = CREATEOBJECT("Trapi")
oFiles = CREATEOBJECT("Tfiles")
#DEFINE ccTargetPath "\my documents\personal\news2news"
#DEFINE ccLogFile ccTargetPath + "\logfile_000.txt"
IF NOT oFiles.PathExists(ccTargetPath)
IF NOT oFiles.CreateDirectory(ccTargetPath)
? "Error:", oFiles.errorcode
RETURN
ENDIF
ENDIF
IF NOT oFiles.FileExists(ccLogFile)
oFiles.StringToFile("Log created: " +;
TRANSFORM(DATETIME()) + CRLF, ccLogFile)
* copying VFP configuration file to mobile device
LOCAL cBuffer
cBuffer = FILETOSTR(SYS(2019))
oFiles.StringToFile(cBuffer, ccTargetPath + "\config.fpw")
ELSE
oFiles.StringToFile("Log written: " +;
TRANSFORM(DATETIME()) + CRLF, ccLogFile, 1)
ENDIF
|
 |
User rating: 0/10 (0 votes) | | | 823 bytes Created: 2004-08-11 18:36:44 Modified: 2004-08-11 18:47:07 Visits in 7 days: 57 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
| The interface of the base class can be easily made more elaborate by adding functions similar to FoxPro FOPEN, FCREATE, FWRITE, FGETS etc. |
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|