Click here to Skip to main content
12,351,694 members (35,228 online)
   

C#

 
AnswerRe: Why SqlCommandBuilder Pin
Eddy Vluggen8-Mar-13 3:01
mvpEddy Vluggen8-Mar-13 3:01 
GeneralRe: Why SqlCommandBuilder Pin
krishnavaradharajan8-Mar-13 3:22
memberkrishnavaradharajan8-Mar-13 3:22 
GeneralRe: Why SqlCommandBuilder Pin
Eddy Vluggen8-Mar-13 4:59
mvpEddy Vluggen8-Mar-13 4:59 
GeneralRe: Why SqlCommandBuilder Pin
Krishna Varadharajan8-Mar-13 5:55
memberKrishna Varadharajan8-Mar-13 5:55 
GeneralRe: Why SqlCommandBuilder Pin
Eddy Vluggen8-Mar-13 7:12
mvpEddy Vluggen8-Mar-13 7:12 
AnswerRe: Why SqlCommandBuilder Pin
PIEBALDconsult8-Mar-13 3:38
memberPIEBALDconsult8-Mar-13 3:38 
GeneralRe: Why SqlCommandBuilder Pin
krishnavaradharajan8-Mar-13 3:59
memberkrishnavaradharajan8-Mar-13 3:59 
GeneralRe: Why SqlCommandBuilder Pin
PIEBALDconsult8-Mar-13 5:42
memberPIEBALDconsult8-Mar-13 5:42 
GeneralRe: Why SqlCommandBuilder Pin
Krishna Varadharajan8-Mar-13 5:56
memberKrishna Varadharajan8-Mar-13 5:56 
QuestionWireless Sensor Node Simulation Time in C# Pin
Nico Encarnacion7-Mar-13 14:45
memberNico Encarnacion7-Mar-13 14:45 
AnswerRe: Wireless Sensor Node Simulation Time in C# Pin
Gerry Schmitz7-Mar-13 18:49
memberGerry Schmitz7-Mar-13 18:49 
GeneralRe: Wireless Sensor Node Simulation Time in C# Pin
Nico Encarnacion12-Mar-13 20:05
memberNico Encarnacion12-Mar-13 20:05 
GeneralRe: Wireless Sensor Node Simulation Time in C# Pin
Gerry Schmitz13-Mar-13 12:10
memberGerry Schmitz13-Mar-13 12:10 
QuestionExplicit type-casting of pointer Pin
Flo_897-Mar-13 11:18
memberFlo_897-Mar-13 11:18 
Hello experts,

I'm quite new to dotnet programming and so on, so perhaps my question is very easy to answer.
I'm sending data from a µC to PC over USB. This is byte wise and when I want so send a float, I did it like in this C++ test code and it worked:

int _tmain(int argc, _TCHAR* argv[])
{
    char test[4] = {25,4,158,63};
    float *blubb = (float*)&test[0];
    printf("%f",*blubb);
    return 0;
}

Now I want to do the same in C# and it doesn't work. Here is my attempt:

namespace csharpfloattest
{
    class Program
    {
        unsafe static void Main(string[] args)
        {
 

                byte[] test = { 25, 4, 158, 63 };
                fixed (float* p = (float*)test)
                {
                    Console.WriteLine(*p);
                }
         }
    }
}

Compiler gives out this error:
Cannot convert type 'byte[]' to 'float*'

Perhaps someone can give me an advice? Smile | :)

Thanks for your help!!
Florian
AnswerRe: Explicit type-casting of pointer Pin
Gerry Schmitz7-Mar-13 12:23
memberGerry Schmitz7-Mar-13 12:23 
GeneralRe: Explicit type-casting of pointer Pin
Flo_897-Mar-13 12:24
memberFlo_897-Mar-13 12:24 
AnswerRe: Explicit type-casting of pointer Pin
Matt T Heffron7-Mar-13 12:34
memberMatt T Heffron7-Mar-13 12:34 
AnswerRe: Explicit type-casting of pointer Pin
harold aptroot7-Mar-13 21:57
memberharold aptroot7-Mar-13 21:57 
QuestionHow to highlight word in word document using C# Pin
Tridip Bhattacharjee7-Mar-13 3:56
memberTridip Bhattacharjee7-Mar-13 3:56 
AnswerRe: How to highlight word in word document using C# Pin
Richard MacCutchan7-Mar-13 5:13
mvpRichard MacCutchan7-Mar-13 5:13 
GeneralRe: How to highlight word in word document using C# Pin
Tridip Bhattacharjee8-Mar-13 1:46
memberTridip Bhattacharjee8-Mar-13 1:46 
GeneralRe: How to highlight word in word document using C# Pin
Richard MacCutchan8-Mar-13 2:16
mvpRichard MacCutchan8-Mar-13 2:16 
QuestionRe: How to highlight word in word document using C# Pin
Alan N7-Mar-13 5:17
memberAlan N7-Mar-13 5:17 
AnswerRe: How to highlight word in word document using C# Pin
Tridip Bhattacharjee8-Mar-13 1:47
memberTridip Bhattacharjee8-Mar-13 1:47 
GeneralRe: How to highlight word in word document using C# Pin
Alan N8-Mar-13 3:12
memberAlan N8-Mar-13 3:12 
QuestionC# file access Pin
classy_dog7-Mar-13 1:52
memberclassy_dog7-Mar-13 1:52 
AnswerRe: C# file access Pin
Dave Kreskowiak7-Mar-13 2:30
mvpDave Kreskowiak7-Mar-13 2:30 
AnswerRe: C# file access Pin
Matt T Heffron7-Mar-13 8:49
memberMatt T Heffron7-Mar-13 8:49 
QuestionHow to use sql server database into oracle Pin
Arun kumar Gautam7-Mar-13 1:04
memberArun kumar Gautam7-Mar-13 1:04 
AnswerRe: How to use sql server database into oracle Pin
Simon_Whale7-Mar-13 1:14
memberSimon_Whale7-Mar-13 1:14 
AnswerRe: How to use sql server database into oracle Pin
jschell7-Mar-13 8:34
memberjschell7-Mar-13 8:34 
AnswerRe: How to use sql server database into oracle Pin
Gerry Schmitz7-Mar-13 19:38
memberGerry Schmitz7-Mar-13 19:38 
QuestionRetrieve Mongodb Images using GridFS C# Winforms Pin
ArunRajendran16-Mar-13 19:38
memberArunRajendran16-Mar-13 19:38 
AnswerRe: Retrieve Mongodb Images using GridFS C# Winforms Pin
Eddy Vluggen6-Mar-13 22:48
mvpEddy Vluggen6-Mar-13 22:48 
QuestionC# in vb.net in windows base application Pin
Jinal Mistry6-Mar-13 19:30
memberJinal Mistry6-Mar-13 19:30 
AnswerRe: C# in vb.net in windows base application Pin
Richard MacCutchan6-Mar-13 22:30
mvpRichard MacCutchan6-Mar-13 22:30 
QuestionMonitoring Applications and Processes Pin
mphill47446-Mar-13 10:37
membermphill47446-Mar-13 10:37 
AnswerRe: Monitoring Applications and Processes Pin
Jim Meadors6-Mar-13 19:49
memberJim Meadors6-Mar-13 19:49 
AnswerRe: Monitoring Applications and Processes Pin
Bernhard Hiller6-Mar-13 23:24
memberBernhard Hiller6-Mar-13 23:24 
GeneralRe: Monitoring Applications and Processes Pin
mphill47447-Mar-13 5:25
membermphill47447-Mar-13 5:25 
AnswerRe: Monitoring Applications and Processes Pin
jschell7-Mar-13 8:40
memberjschell7-Mar-13 8:40 
Questionc# file directory structure change Pin
classy_dog6-Mar-13 10:19
memberclassy_dog6-Mar-13 10:19 
AnswerRe: c# file directory structure change Pin
Matt T Heffron6-Mar-13 12:42
memberMatt T Heffron6-Mar-13 12:42 
GeneralRe: c# file directory structure change Pin
classy_dog6-Mar-13 18:50
memberclassy_dog6-Mar-13 18:50 
GeneralRe: c# file directory structure change Pin
Matt T Heffron7-Mar-13 8:29
memberMatt T Heffron7-Mar-13 8:29 
AnswerRe: c# file directory structure change Pin
Jegan Thiyagesan6-Mar-13 13:03
memberJegan Thiyagesan6-Mar-13 13:03 
GeneralRe: c# file directory structure change Pin
classy_dog6-Mar-13 18:45
memberclassy_dog6-Mar-13 18:45 
GeneralRe: c# file directory structure change Pin
Jegan Thiyagesan6-Mar-13 21:17
memberJegan Thiyagesan6-Mar-13 21:17 
Questionpass Convert.ToDateTime to date in MysqlDataType Pin
Jassim Rahma6-Mar-13 2:21
memberJassim Rahma6-Mar-13 2:21 
AnswerRe: pass Convert.ToDateTime to date in MysqlDataType Pin
Eddy Vluggen6-Mar-13 3:16
mvpEddy Vluggen6-Mar-13 3:16 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 27 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid