|
Hi all,
How can I perform the following C++ structure code within C#?
struct EmpStruct
{
char name[15];
char surname[15];
}EMP[100];
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Is this correct:
public struct EMP
{
public string name;
public string surname;
}
....
EMP [] employee = new EMP[100];
....
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
(It is )
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
No, not yet ... but according to some code snippets I saw on the web it looks like it will work.
Thanks for the response.
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
there is a difference:
in unmanaged C/C++ the struct EmpStruct has a size of 30 (or 32), since it contains 30
characters.
your C# struct has a size of 8 (or 16 on Win64) since it contains two references and
no characters.
So it all depends what you are trying to do:
- if you are porting a C/C++ app to C#, it could be good enough;
- if you want your C# to cooperate with existing software or hardware that needs the
original struct EmpStruct, then it is not OK, and you will need special Marshalling
instructions.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks for the response Luc, well I'm rewriting a application into C# from C++ .... so that is the only reason I was asking.
Thanks again
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
the structs are value types and classes are reference types.
f(yf) = yf
|
|
|
|
|
|
Hi,
We, in our office use a remote Matlab License server running FlexLM license manager. Since we have very few floating licenses we end up asking to release the license from the fellow engineers many times a day.This creates confusion as we are not knowing who is actually using the license.
To automate this I plan to make a simple application wherein I'll monitor the connection to that particular matlab server and see which user has actually hooked up a license if a socket to that server:port becomes alive. Then I would start broadcasting to the rest of the users that this user is using the License.
This can be achieved my making a service that would feed a frontend application with the broadcast details which would let people actually know who is using the license. It is a simple License viewer.
Since I don't have administrative access to the license server (it is organization wide server) so I just can monitor connections from my system or from a group of users who actually install the service I am planning to make.
My only concern now is since I am to use broadcast mode for letting others know I have hooked up a license I would be in trouble with network bandwidth.
Does anybody have a better architecture to prevent the broadcast and use some other tricky method.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
Just curious. What's the cost of a couple new licenses versus the cost of you developing this application and supporting it for the same amount of time as you'll use the licenses??
You'd have to have some kind of central server that each client application would have to connect to. This server would probably keep track of the license use and notify the clients directly instead of broadcasting. So that's TWO applications you have to write, not one.
|
|
|
|
|
Well just to answer your First Question 4 Floating licenses of Matlab with only Simulink and Stateflow costs you around 8,200,000 INR which is equivalent to 206,861.4 US$. Hence a small application would be always better than procuring few more license.
Moreover getting approval for license and all needs a huge cycle time, against which developing an application would always be better
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
Shouvik Das wrote: equivalent to 206,861.4 US$
Matlab programmers must be cheap then
|
|
|
|
|
Hi,
I need help how I can convert the string below to ASCII(HEX)
for (int i = 0; i<=5; i++)
{
int counter = 0x0 + i;
string destinationAdress += (char)s[counter];
...
}
Thanks in advaced
merh
|
|
|
|
|
merh wrote: for (int i = 0; i<=5; i++)
{
int counter = 0x0 + i;
string destinationAdress += (char)s[counter];
...
}
What is all this?
0x0 is exactly the same as 0
o+i is exactly the same as i
you did not tell what s is
if s is a string, then s[counter] is a char and does not need a (char) cast
if s is an array of ints (just a guess), then you want some conversion from int to char. do you?
I think you better explain a bit more what it is you are after.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
thanks I have found the solution. Explanation "s" is a byte array and 0x0 is the first element
int counter = 0x0 + i;
string Number = s[counter].ToString();
int number = int.Parse(Number);
destinationAdress += number.ToString("x2");
|
|
|
|
|
Hi,
your code has too many ToString/Parse calls. To convert a byte to an int, you don't need
these!
byte[] s = ...;
string destinationAdress = "";
for (int i = 0; i<6; i++) {
byte b = s[i];
destinationAdress += b.ToString("x2");
}
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
hello,
im running process from my gui in C#, its console application and id like to copy its output in seconds interval into clipboard. how can i send keys to that process to do something like i do manual (click on console menu - Edit - Select all - press ENTER). im trying this way because for specific reason RedirectStandardOutput and using stream doesnt work like it should (its copying just 80 characters width from console).
thank you
|
|
|
|
|
|
thank you but thats what i was trying long time but it just didnt work well with my application.
|
|
|
|
|
we meet again!
did you ever try with ProcessStartInfo.CreateNoWindow=true?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
hello mr. yeah i tried all combinations of that process.startinfo but wasnt successful and i was speaking to one guy that also had this problem and he didnt find solution cause its probably some problem with cygwin applications. so im trying this way. do you know how i could copy it from console?
|
|
|
|
|
dwrst wrote: do you know how i could copy it from console?
No. The only thing I ever did programmatically to a Console is set font colors.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
I have one doubt,i have developed one software and now iam going to sell it.before selling that package i want to give a trial version to the customer (for 2 weeks) and after that period that software should expire.how can i do it.
Please any one help me regarding in this matter by giving a piece of code or by giving the hint how to solve this problem
Thanks to All
Thanks
modified on Saturday, April 19, 2008 3:34 AM
|
|
|
|
|
You have to come up with a method to do this. If there was one method that everyone used, we'd all know how to defeat it, too. And, of course, anyone can decompile your app, remove your code and recompile it, anyhow.
One thing I will tell you is, don't rely on the date the app was first installed, the file system seems to mess with that, I've had trouble trying to use it in the past.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
dont forget to use obsfucator (from v studio tools menu ) to protect code from disassembling
f(yf) = yf
|
|
|
|