Searching for files
Displaying 21-25 of 25 total.
prev 1 2
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
CrazyAznGamer

Quote:Originally posted by Overkill

I dunno, look at the source sometime, under vc_builtins.cpp. There are many functions and function place-holders! Though a lot of these function placeholders don't even have vc_MyFunctionName() function defined in vc_library.cpp.

Well, I knew that, but place-holders...
Heh. Talk about Verge tradition.

In any case, don't we already have a sort of OOP thing going on with some sort of DMA... scripting engine for Verge?

Posted on 2006-04-02 23:11:49

Overkill

Sure, but DMA is int/word/byte orientated, and fails miserably with strings. Dictionaries are a slower but are able to store either strings or ints dynamically, with a string key to access them.

Posted on 2006-04-03 06:10:26

Interference22

Ok, guys. Here's a little something to make using ListFilePattern much easier: the code I'm using to process it's output. It sorts the string returned from ListFilePattern into an array and returns how many files were found:


string filelist[1000];

int ListFiles(string pattern)
{
int countpos = 0;
int numfiles = 0;
string files = ListFilePattern(pattern);

while (countpos < len(files))
{
if (!strcmp(mid(files, countpos, 1), "|"))
{
filelist[numfiles] = left(files, countpos);
files = right(files, len(files)-(countpos+1));
numfiles++;
countpos = 0;
}
else { countpos++; }
}
return numfiles;
}


I know. You all love me.

Posted on 2006-04-16 17:44:31

Overkill

This can be written simpler and more efficiently using the token functions.

string filelist[1000];

int ListFiles(string pattern)
{
int i;
string files = ListFilePattern(pattern);

if (!len(files)) return 0; // No files found!

// TokenCount() - 1 because there's always an extra | at the end on successful searches.
for (i = 0; i < TokenCount(files, "|") - 1; i++)
{
filelist[i] = GetToken(files, "|", i);
}

return TokenCount(files, "|") - 1;
}

Posted on 2006-04-17 11:59:20 (last edited on 2006-04-17 11:59:45)

Interference22

Point. I've only recently started using the token functions. Yes, people occasionally mistake me for a luddite..

Posted on 2006-04-17 17:49:55


Displaying 21-25 of 25 total.
prev 1 2
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.