المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Trying to call a c++ function in C# code using PInvoke



C# Programming
06-18-2009, 11:51 AM
Hi All,

I am trying to call a C++ function into C# using PInvoke. The C++ function accepts a filename as a parameter and then writes to that file.
However, the hitch is when a simple filename is passed from C#, at the C++ end it is implicitly appended with Escape characters which is why it cannot find the file.

For Eg: If I pass a file as "ABC.txt" which lies in my bin\debug folder of the C# application, at the C++ end it becomes bin\\debug\\abc.txt which is wht it cannot write to the file.

Did anyone encounter a similar problem and has resolved it?
Kinldy help me out here.
Any help is appreciated.

Thanks in advance
Siddy