|
I have the following c++ declaration
static FT_STATUS FT_ListDevicesEx(String *DevicesList);
{
DevicesList = "Hello";
}
Inside this function I modify the DeviceList string, but when I return to my c# code the string is not changed.
in c# i use the following code to pass the string.
string a = "12345";
FTDI.FT_ListDevicesEx(a);
When I arrive in ListDevicesEx the DevicesList string is 12345, then is modified in Hello, but at return in c# a = 12345 again!
What is the solution ?
Best regards.
|
|
|
|
|
You need to use the "ref" keyword from C#. Also, make sure that the "ref"-style usage is declared for the C++ function as well (if it isn't already set that way).
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
|
<br />
Regex regex = new Regex(@"(?>\w|\d|\s|\B)[^;]+"); <br />
<br />
my input:<br />
matchCollectionReceivers = regex.Matches("Gerald...'§'ö3 Hello; Mike; Fuxxe123_10");<br />
<br />
output: array[0] = "Gerald...'§'ö3 Hello";<br />
array[1] = " Mike";<br />
|------- here is a space...i dont like that!<br />
arrey[2] = " Fuxxe123_10";<br />
<br />
<br />
Regex regex = new Regex(@"(?>\w|\d|\s|\B)[^; ]+"); <---- don't work!?<br />
how can i say all characters but without "; " ?
cu
|
|
|
|
|
Have you tried [^;\s]+ ?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
What about this?
(?>\w|\d||\B)[^;\s]+
Btw, if you want to strip all string with an ; or \s between each other, why not use the String.Split() function?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
<br />
input "Gerald 123; Franz!'§§"<br />
<br />
regex: Regex regex = new Regex(@"(?>\w|\d|\B)[^;\s]+");<br />
<br />
output:<br />
array[0] = "Gerald";<br />
array[1] = "123";<br />
array[2] = "Franz!'§§";<br />
<br />
but i want have: array[1] = "Gerald 123";<br />
array[2] = "Franz!'§§";<br />
<br />
i know its better to use the split function
but i want to run that with regex...but it's not possible?
cu
|
|
|
|
|
Do you actually want to split the spaces or the semicolons?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
the regex should work like that:
<br />
char[] separators = new char[] {';'}; <br />
foreach (string sub in textBox_Receivers.Text.Split(separators))<br />
{<br />
string str = sub.Substring(0, sub.Length);<br />
if(str.StartsWith(" ")) <br />
{<br />
str = str.Remove(0,1); <br />
}<br />
<br />
Receivers.Add(str);<br />
} <br />
cu
-- modified at 16:05 Thursday 8th September, 2005
|
|
|
|
|
\s?([^;]+)
This one works fine for me
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
yeah thats fine:
<br />
MatchCollection matchCollectionReceivers;<br />
Regex regex = new Regex(@"\s?([^;]+)"); <------- whats the '?' here? = AND?<br />
matchCollectionReceivers = regex.Matches(textBox_Receivers.Text);<br />
<br />
foreach (Match m in matchCollectionReceivers) <br />
{ <br />
string str = m.Value;<br />
if(str.StartsWith(" "))<br />
{<br />
str = str.Remove(0,1);<br />
}<br />
<br />
Receivers.Add(str);<br />
}<br />
advantage: less code lines than the .split() version
cu+thx
|
|
|
|
|
No, the ? means that the space is optional.
But your code is wrong - I put brackets around the [^;]+ so that the results will be stored in a GroupCollection. This way you don't need to check for any leading spaces anymore.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Regex r = new Regex(@"\s?([^;]+)");
MatchCollection m = r.Matches("Gerald 123; Franz!'§§");
foreach (Match mc in m)
{
Console.WriteLine(mc.Groups[1].ToString());
}
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi, look for my last code past! i can see brackets around: Regex regex = new Regex(@"\s?([^;]+)");
why do you write mc.Groups[1]? in m.Groups[2] are the space?
cu
|
|
|
|
|
mc.Groups[0] is the whole matched group including the optional space, while mc.Groups[1] is the group matched by the ([^;]+)
There is no mc.Groups[2] as far as I know.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Forgive my ignorance, I am often given small tasks on projects where I have little experience, and not a lot of time for a learning curve on so short a task.
I've been asked to make minor mods to a C program.
The files I have are .cpp and .h . This is C, as opposed to C++, correct?
And I cannot (at least, not effectively) edit and compile this in Visual Studio? (There is no .sln file and the .cpp and .h files do not show up as 'add existing'-able files.)
I'm googling for answers about how I'm going to go about this, but most info out there sort of starts at a lower level of info than I'm looking for.
I'll probably be back with more questions when I go to compile and such (like where do I get/put all the class libraries and stuff), so any preemptive help on the 'start-to-end' of a C program is appreciated.
Thanks.
________________________________________________________________________
Dave
Y10K bug! Let's not get caught with our pants down **AGAIN**! (DC 02002)
|
|
|
|
|
I'll help you out, although C has little to do with C#
.cpp is indeed associated with C++. If you do not have a solution then make one, then add the files in and hope things work. You might want to go to the project settings to configure additional include directory, libraries, and other settings. I cannot help you any further since I dont know what files you are working with.
If you need additional help getting things working I suggest you post in the C++ forum.
Alex Korchemniy
|
|
|
|
|
Thanks, yes. I was opening the wrong type of project. Now I just have to figure out why these two files are is missing. The debugger chokes on includes called wx/wxprec.h and stdafx.h.
There is a stdafx.h in a subfolder, but adding it to the project doesn't fix the problem.
I'm going to take this over to the C++ forum. Thanks for your help.
________________________________________________________________________
Dave
Y10K bug! Let's not get caught with our pants down **AGAIN**! (DC 02002)
-- modified at 16:45 Thursday 8th September, 2005
|
|
|
|
|
DaveC426913 wrote:
The files I have are .cpp and .h . This is C, as opposed to C++, correct?
No, cpp stands for C++. A C++ program rarely uses .hpp instead of .h.
DaveC426913 wrote:
And I cannot (at least, not effectively) edit and compile this in Visual Studio? (There is no .sln file and the .cpp and .h files do not show up as 'add existing'-able files.)
Try creating a console application and then adding these files to it.
Where did these files come from ? Why are you trying to compile them outside of a project, surely they will end up in a project, can't you compile them there ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm going to be working on a fairly complex application soon and one of the features I'd like to integrate into it is a remote desktop/vnc type control. I've done a couple searches on google but didn't come up with much.
So basically I'm looking for a .net component to use in a WinForms app. The majority of the systems this will be used are running XP Pro so might there be a way to integrate RDP as an ActiveX control?
I'm just pulling ideas out of thin air at the moment so any ideas or suggestions would be great.
Thanks
Found on Bash.org
[erno] hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
-- modified at 14:03 Thursday 8th September, 2005
|
|
|
|
|
I dont have any experience with this but I tried searching for "terminal services activex" and found an interesting article on "Remote Desktop ActiveX Control Interface" from Microsoft ... seems promising.
Alex Korchemniy
|
|
|
|
|
Hello,
I'm looking for a way to load multiple instances of the same dll into one c# application.
The facts are:
1) The assembly is third-party, so recompiling/modification is not an option!!!
2) The assembly is programmed in C.
3) It is to be used for COM-port communication.
4) Different instances of the assembly is needed for binding separate COM-ports.
5) Only one port can be bound per loaded dll.
I've read a solution on this site on how to dynamically load dll's from C# by using the win32 LoadLibrary/GetProcAddress etc. Pretty cool though, but it would involve the ugliness of renaming the original dll for every new instance I need and a somewhat cumbersome native generic invoke method.
I'm a basically looking for a way to load the same dll into different AppDomains without it being domain-neutral. Is there a way to ensure that a dll (and its dependency closure) is NOT to be shared among the different AppDomains (to the effect that each AppDomain has its own instance of the assembly)?
Any suggestions would be appriciated.
|
|
|
|
|
I think the only way you will be able to do this is using a multi-process approach and using .net remoting or some other IPC mechanism to communicate. AppDomains are .net only and P/Invoke will still end up using LoadLibrary in the end.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
I have Visual Studio C++ V6. After updating with SP6 my SourceSafe became V6.0d. Fine.
Now ... I just bought C# Std and guess what? it won't use my SourceSafe!
C# actually tells me I've got SourceSafe Version 4.xx and I should upgrade to version 5 or higher.
My SourceSafe About dialog says I've got V6.0d.
Is there any way Visual Studio C++ V6 SourceSafe (or other SourceSafe?) can be used with C# standard?
Many Thanks
|
|
|
|
|
AFIAK things should work. SourceSafe hasn't had an update for a while. 6d should work fine. Try reinstalling SourceSafe.
Alex Korchemniy
|
|
|
|