I have an sbyte array with a length of 4. What these four bytes represent is a single 32-bit number. I don't know how to convert the 4 sbyte elements into a single 32-bit number in C#. I could do this easily in C or C++ by casting a pointer to the first element as a pointer to Long and then dereferencing the pointer to get at the long. How do I do this in C#? BRCKCC
BrcKcc
Posts
-
32 bit integer from sbyte array -
Editing the RegistryLook at the Microsoft.Win32.Registry class. This has all the functionality you need to create keys and modify them. BRCKCC
-
Account Property of Active Directory/Win 2k usersSorry. Try this link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/a\_useraccountcontrol.asp Sorry, the other link was bad. - Bruce BRCKCC
-
Account Property of Active Directory/Win 2k usersThis 'flag' is actually part of a MS defined enumeration that is the value of the userAccountControl attribute. More documentation is available at: http://msdn.microsoft.com/library/default.asp?url=/library/en-s/adschema/adschema/a\_useraccountcontrol.asp Try this and see if it helps. - Bruce BRCKCC
-
Account Property of Active Directory/Win 2k usersThis 'flag' is actually part of a MS defined enumeration that is the value of the userAccountControl attribute. More documentation is available at: http://msdn.microsoft.com/library/default.asp?url=/library/en-s/adschema/adschema/a\_useraccountcontrol.asp Try this and see if it helps. - Bruce BRCKCC
-
Escape characters in text boxI'm converting a C++ application to C# (yes - I know, dumb thing to do). The issue I've run into is when I put text into a text box, in C++ I could just add a \n to get a new line. Now, in C# text boxes, I have to add \r\n to get the same result. Why? Is there anyway I can get around this? - Bruce BRCKCC
-
Converting .rc files to .resxIs there any easy way to convert .rc (C++ resource) files to .resx (C# resource) files? I have a C++ project which I'm converting to C# and don't want to have to write my own utility to convert the old resource files over. BRCKCC
-
Casting problemI have the following code: /* In myprog.exe - I get an exception here */ catch (LdapException e) { string port = String.Format("{0}", ldapPort); m_log.LogMessage("strCantConnectToLdap", "strCantConnectToLdapTitle", e, ldapHost, port, loginDN); return false; } /* which calls this in my.dll */ public DialogResult LogMessage(string headerTag, string messageTag, LdapException e, string sub1, string sub2, string sub3) { string [] subParams = new string[3]; subParams[0] = sub1; subParams[1] = sub2; subParams[2] = sub3; return FullLogMessage(headerTag, messageTag, MigError.ErrorLevelE.ERROR, e, subParams); } /*which call this in my.dll */ public DialogResult FullLogMessage(string messageTag, string headerTag, MigError.ErrorLevelE level, Exception exception, string [] subParams) { // Rework for different types of exceptions if (exception != null) { if (exception is LdapException) /* should succeed but doesn't - why?*? :confused:*/ { LdapException e = exception as LdapException; format = LoadString("strLdapExceptionFormat"); string ldapErrorString = MapLdapError(e.ResultCode); exceptionMessage = String.Format(format, e.LdapErrorMessage, e.resultCodeToString(), ldapErrorString, e.StackTrace); } else ... } } Any ideas? BRCKCC
-
Calling Java from C#Anyone have some good example code for calling Java routines from C#? - Bruce :confused: BRCKCC
-
memcmp in C#Thanks very much. - Bruce :) BRCKCC
-
memcmp in C#Do you have a snippet of code on how to do this "casting"? BRCKCC
-
memcmp in C#I'm using the for loop and since I don't want to sacrifice portability, I'll stick with the for loop. Thanks. - Bruce BRCKCC
-
memcmp in C#I want to compare two byte buffer quickly. I used to do this with memcmp in C. I can't find a function to do that in C#. I'm sure there is one, but I can't find it. BRCKCC
-
Simple (I think) Inheritance questionBy the way, if you are going to be doing a lot with tree controls, you might look at the Infragistics tree control. It's a bit expensive, but it has a lot more flexibility than the Microsoft standard tree control. - Bruce BRCKCC
-
String formatting questionIt was in the debugger. It turns out when I displayed the string via MessageBox.Show(), it only had one backslash. So thanks for that clarification. The @ symbol has been confusing. How do I convert a string defined with the @ symbol to a string without the @ symbol? Do you know where Microsoft documented this capability? Thanks. - Bruce BRCKCC
-
String formatting questionI want to format a string with embedded backslashes. The string that I want is as follows: This is John I\. Smith. Here's the code snippet: string temp1 = "John I\\. Smith"; string temp2 = String.Format("This is {0}.", temp); What I get in temp2 is: This is John I\\. Smith. instead of This is John I\. Smith. How do I get rid of the extra backslash? BRCKCC