forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Brackets in filenames

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Mon Feb 28, 2005 12:03 pm    Post subject: Brackets in filenames Reply with quote

A couple of times I have seen the claim that VDS doesn't allow brackets in filenames. Following something that I did this morning, I think I understand the problem.

I had a bit of code like this, to try to generate a unique filename:

Code:
%I = 1
while @file(%%rootdir\%%name(%I).txt)
  %I = @succ(%I)
wend


This went into an endless loop. I established that the expression:

%F = @file(%%rootdir\%%name(%I).txt)

resulted in a value for %F of ".txt)". The first terminating btacket was being used as the end of the function.

This is not a bug in VDS, but it is an easy trap to fall into. The reason is that VDS does not require you to put quotes round text that is simply text. Other languages do, so that you would have to write something like:

%F = @file(%%rootdir+"\+"%%name+"("+%I+").txt")

and the compiler would not become confused.

VDS would probably be a better language, technically, if it required strings to be quoted, but despite the occasional problem it causes, I'm glad that you don't have to.

PS: After previewing this posting I notice that VDSWorld displays the warning: "inconsistent @ character, opening bracket and closing bracket count on previous line" in my code. Now, the code actually is not wrong code. Although in my example "@file(%%rootdir\%%name(%I)" followed by ".txt)" clearly is nonsense, there could be cases where you want to have brackets in strings that result in a mismatched count. But perhaps it would be a worthwhile addition to the VDS 6 compiler to display a similar warning.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group