Link to home
Start Free TrialLog in
Avatar of BWarmuskerken
BWarmuskerken

asked on

Passing info to a DLL

I'm attempting to write a DLL that I can call from another application that I use.  The functions in the DLL are relatively simple and I have managed to get them to work except for one thing.  

Here is the Function and parameters;
char* StripDuplicates(char* sFromAMS, int iCaseSensitive)
{
//my functions code here
}

My problem is that when a File and Pathname (i.e. C:\Music\test.mp3;;C:\Music\sample.mp3) are passed to the DLL, the function blows up because of the backslash.  Keep in mind that the function needs to pass the same string back after it has been sorted accordingly.  How do I work around this?
Avatar of bkrahmer
bkrahmer

Where are you getting the filenames from?  If you are coding them like this: char fname[] = { "c:\temp\foo" }, this will not work.  You need to add another slash to escape each slash, ala c:\\temp\\foo.
brian
Avatar of BWarmuskerken

ASKER

The filenames are being passed by the application calling the dll.  I'm using a Media Authoring program that allows you to call DLLs from within, passing it parameters.  In this case, the sFromAMS parameter would hold a delimited string such as "C:\temp\foo\1.mp3;;C:\temp\foo\2.mp3;;C:\temp\foo\3.mp3"

I then take this string, break it apart into an array, sort it, then reassemble the string with delimiters.

I'm aware that I need a double backslash (\\), but how do I change that in the passed parameter sFromAMS?

The filenames are being passed by the application calling the dll.  I'm using a Media Authoring program that allows you to call DLLs from within, passing it parameters.  In this case, the sFromAMS parameter would hold a delimited string such as "C:\temp\foo\1.mp3;;C:\temp\foo\2.mp3;;C:\temp\foo\3.mp3"

I then take this string, break it apart into an array, sort it, then reassemble the string with delimiters.

I'm aware that I need a double backslash (\\), but how do I change that in the passed parameter sFromAMS?

ASKER CERTIFIED SOLUTION
Avatar of PlanetCpp
PlanetCpp

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am extemely new to C++ and am easily confused by the whole pointer thing.  I'm sure that I don't have to have it be a pointer.  I thought that the char* meant it was an Array.  Eeeech!

Maybe I should drop back and do some more reading, before I waste to many peoples time.
   
My lack of understanding the while pointer deal.  You were exactky right,  the string having a \ in it had nothing to do with my problem