Click here to Skip to main content
15,904,415 members
Home / Discussions / C#
   

C#

 
Questionaccess other system drive on LAN in .net Pin
220815-Oct-09 21:00
220815-Oct-09 21:00 
AnswerRe: access other system drive on LAN in .net Pin
Rajesh Anuhya15-Oct-09 21:44
professionalRajesh Anuhya15-Oct-09 21:44 
GeneralRe: access other system drive on LAN in .net [modified] Pin
220816-Oct-09 18:44
220816-Oct-09 18:44 
AnswerRe: access other system drive on LAN in .net Pin
Dave Kreskowiak16-Oct-09 4:58
mveDave Kreskowiak16-Oct-09 4:58 
GeneralRe: access other system drive on LAN in .net Pin
220816-Oct-09 16:27
220816-Oct-09 16:27 
GeneralRe: access other system drive on LAN in .net Pin
Dave Kreskowiak16-Oct-09 18:20
mveDave Kreskowiak16-Oct-09 18:20 
GeneralRe: access other system drive on LAN in .net Pin
220816-Oct-09 18:32
220816-Oct-09 18:32 
GeneralRe: access other system drive on LAN in .net Pin
Dave Kreskowiak17-Oct-09 5:40
mveDave Kreskowiak17-Oct-09 5:40 
QuestionCreating a setup for a project using c# Pin
Vinod T G15-Oct-09 20:01
Vinod T G15-Oct-09 20:01 
GeneralMaking .exe setup Pin
HEART2HACKER15-Oct-09 19:15
HEART2HACKER15-Oct-09 19:15 
GeneralRe: Making .exe setup Pin
Calla15-Oct-09 19:27
Calla15-Oct-09 19:27 
GeneralRe: Making .exe setup Pin
Abhijit Jana15-Oct-09 20:32
professionalAbhijit Jana15-Oct-09 20:32 
Questionhow do i get the duration of a video? Pin
thaiphu15-Oct-09 18:28
thaiphu15-Oct-09 18:28 
AnswerRe: how do i get the duration of a video? Pin
Christian Graus15-Oct-09 20:57
protectorChristian Graus15-Oct-09 20:57 
GeneralRe: how do i get the duration of a video? Pin
thaiphu15-Oct-09 21:58
thaiphu15-Oct-09 21:58 
QuestionVoip , SIP and ZRTP Pin
Mike Bond15-Oct-09 17:02
Mike Bond15-Oct-09 17:02 
AnswerRe: Voip , SIP and ZRTP Pin
Christian Graus15-Oct-09 20:59
protectorChristian Graus15-Oct-09 20:59 
QuestionWhen remoting, how can the server application reference objects created by remote applications? Pin
wrecking ball15-Oct-09 13:33
wrecking ball15-Oct-09 13:33 
AnswerRe: When remoting, how can the server application reference objects created by remote applications? Pin
dataminers15-Oct-09 13:55
dataminers15-Oct-09 13:55 
Questionquery odbc schema Pin
JollyMansArt15-Oct-09 11:36
JollyMansArt15-Oct-09 11:36 
AnswerRe: query odbc schema Pin
Not Active15-Oct-09 12:32
mentorNot Active15-Oct-09 12:32 
QuestionParsing data sent via socket when you can't cast to a typedef Pin
FoxholeWilly15-Oct-09 10:16
FoxholeWilly15-Oct-09 10:16 
AnswerRe: Parsing data sent via socket when you can't cast to a typedef Pin
Luc Pattyn15-Oct-09 10:45
sitebuilderLuc Pattyn15-Oct-09 10:45 
Hi,

I have some pointers for you:

1.
this is not a typedef, it is a struct.
C# knows about structs.

2.
in .NET an array is a managed object, hence the struct would contain an int, a reference to some Unicode characters, and a float. Not what the other side is thinking of.

3.
if the string really is 15 8-bit characters, I suggest you use a byte array, not a char array. That solves the width problem. It also needs a conversion, as offered by Encoding.GetBytes and Encoding.GetString; you need the proper encoding for this to handle your top half of the charset correctly; in the Western world Encoding(1252) is the prime candidate.

4.
now you must make sure the array content, not its reference, sit inside the struct.
that takes [StructLayout(LayoutKind.Sequential)] before the struct
and [MarshalAs(UnmanagedType.ByValArray, SizeConst=15)] before the byte[]

5.
then there is the issue of padding, here the question is: does or doesn't the C++ side insert a dummy byte to get the float "naturally aligned". I don't know, it depends on compiler defaults and possible presence of explicit pragma's. Easiest would be to look at the data, and/or try both. A simple way to force padding is by inserting a byte as in byte dummy;; there isn't a simple way to avoid padding. I tend to use
[FieldOffset(x)] in front of every struct member, where x is the byte offset you have to calculate correctly.

So, this should get you started (for a long while maybe).

Smile | :)

Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages

Local announcement (Antwerp region): Lange Wapper? Neen!


modified on Thursday, October 15, 2009 4:56 PM

QuestionExcel C# question Pin
antsims15-Oct-09 9:45
antsims15-Oct-09 9:45 
AnswerRe: Excel C# question Pin
Luc Pattyn15-Oct-09 10:00
sitebuilderLuc Pattyn15-Oct-09 10:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.