I'm glad you got some inspiration after all the perspiration.
Get a Moderator to close your question and refund your points.
Main Topics
Browse All TopicsUsing FoxPro 9, SP2. I have a function that simply adds desired text to a log file with a date and time stamp precedding the text. Before adding, it checks to see if that particular string of text already exist. If it does, it replaces the date and time stamp with the current date and time. If it does not, it adds to the end of the file. From the command line, I get the results expected. I have SRVANY running on a Windows 2003 server. It calls an exe that has a timer that when fired, calls a second exe. This code is in the second exe. However, when run from the server, the log entries are always added to the end of the log file, not replaced as expected. Since it works perfectly from the command window, I am clueless where to start.
FUNCTION SetLog
PARAMETER TextToAdd
* add text to log file with date/time stamp if the text does not exist, if it does, replace that line
IF FILE('MyLog.txt')
FileContents=FILETOSTR('My
NewFile=''
LineAdded=.F.
FOR MyCount=1 TO MEMLINES(FileContents)
TheLine=MLINE(FileContents
TheText=SUBSTR(MLINE(FileC
IF UPPER(ALLT(TheText))==UPPE
NewLine=TRANSFORM(DATETIME
LineAdded=.T.
ELSE
NewLine=TheLine
ENDIF
NewFile=NewFile+IIF(EMPTY(
NEXT
IF !LineAdded
NewFile=NewFile+IIF(EMPTY(
TRANSFORM(DATETIME())+' '+ALLT(TextToAdd)
ENDIF
ELSE
NewFile=TRANSFORM(DATETIME
ENDIF
SET SAFETY OFF
STRTOFILE(NewFile,'MyLog.t
SET SAFETY ON
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here's the official EE blurb on this:
I answered my question myself. What do I do?
http://www.experts-exchang
Business Accounts
Answer for Membership
by: wcsoctuPosted on 2007-10-17 at 11:11:25ID: 20095649
After working for too long on this problem, I made this post. Right after I noticed the year was 4 digits on my machine, but I never SET CENTURY ON in my executeable, thus the subtring was returning the wrong text to compare to. Problem self inflicted, problem solved.