The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Extending/Wrapping GetFilenamesInFolder()
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cdrozdowski111

USA
247 Posts

Posted - 02/14/2013 :  1:20:47 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I have developed an custom Origin C function that wraps the Origin C function GetFilenamesInFolder().

I have done this for two reasons:

1) To modify the ref string containing the list of files generated by GetFilenamesInFolder(). My function changes the separator from "|" to "\r\n".
2) To make the functionality of GetFilenamesInFolder() available to LabTalk.

Can someone take a look at my code below to make sure it is kosher? It does compile and runs when called from LabTalk.



int myGetFilenamesInFolder(string& strFilenameList, string strPath = "", string strFilter = "", int nRecursive = 0, int nDisplayOptions = 0)
{
int nRetOK = 0;

BOOL bRecursive = (nRecursive > 0 ? TRUE : FALSE);
UINT uDisplayOptions = (nDisplayOptions > 0 ? nDisplayOptions : 0);

// GetFilenamesInFolder() puts the list of files found in strFilenameList separated by "|"
nRetOK = GetFilenamesInFolder(strFilenameList, strPath, strFilter, bRecursive, uDisplayOptions);

// Replace "|" separator in strFilenameList with "\r\n"
strFilenameList.Replace("|", "\r\n");

return nRetOK;
}

Penn

China
644 Posts

Posted - 02/15/2013 :  8:14:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have tried your code, it works after compiling done, in LabTalk like

string str$;
myGetFilenamesInFolder(str$);
str$ = ;


Penn
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 02/15/2013 :  8:53:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000