Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why one code works, while other doesn't?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Why one code works, while other doesn't?
Miscellaneous
Thread ID:
00466654
Message ID:
00466654
Views:
47
Hi everyone,

I had this peice of code, working fine:
create cursor lcTempCursor ;
	(WorkField M)
append blank

for i=1 to lntxtfiles

	lcFileName=lcPath+laTxtFiles[i,1]
	lnFileSize=laTxtFiles[i,2] && File Size
	lcSendFileName = lcPath+lcCurState+'\'+left(laTxtFiles[i,1],4)+'.txt'
	wait window nowait 'Preparing file '+lcSendFileName
	if file(lcSendFileName)
		erase (lcSendFileName)
	endif

	if lnFileSize< 5000000 && Small files

		append memo WorkField from (lcFileName) overwrite
		if !empty(alltrim(WorkField))
			replace WorkField with strtran(WorkField,'"','')
			copy memo WorkField to (lcSendFileName)
		endif
I changed it to be (I commented maximum size just for now, because the previous size doesn't work):
	wait window nowait 'Preparing file '+lcSendFileName
	if file(lcSendFileName)
		erase (lcSendFileName)
	endif

	if lnFileSize< 5000000 && 16777184 && Relatively small files <16 MB
		lcString=filetostr(lcFileName)
		lcString=strtran(lcString,["],'') && Remove double quotes
		llReturn=strtofile(lcString, lcSendFileName)
The first code works. The last code doesn't for some reason. I thought, the last code is more efficient, that's why I changed this program. What could be wrong here?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform