Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about strtofile and multi-user environment
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01155500
Message ID:
01155523
Views:
30
>>Thanks, Sergey. I guess, it's not a big of a deal if some information would not end up in the log. I don't think this situation would ever occur.
>>
>
>Are you using STRTOFILE() in append mode?

Yes.
*-- Writes to logfile
	procedure WriteToLogfile
	lparameters tcstring, tlNoTime
	if m.tlNoTime
		=strtofile(m.tcstring + CRLF, this.cLogFileDir + this.cLogFile, 1)
	else
		=strtofile(ttoc(datetime()) + " " + ;
			m.tcstring + CRLF, this.cLogFileDir + this.cLogFile, 1)
	endif
	endproc
I may try to change this code to do it in cycle. Do you think it's necessary?

Well, reading Help helps <g>

Unlike earlier versions of Visual FoxPro, STRTOFILE( ) opens a file in Shared rather than Exclusive mode. This is useful when multiple servers attempt to simultaneously write to the same file. Because of this change, you might not need to check for STRTOFILE( ) to return 0 (failure to open a file).

I also made a change to use just one line of code with iif rather than if/else/endif
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform