Click here to Skip to main content
       

C#

 
GeneralRe: Why SqlCommandBuilder Pinmemberkrishnavaradharajan8-Mar-13 3:59 
GeneralRe: Why SqlCommandBuilder PinmemberPIEBALDconsult8-Mar-13 5:42 
GeneralRe: Why SqlCommandBuilder PinmemberKrishna Varadharajan8-Mar-13 5:56 
QuestionWireless Sensor Node Simulation Time in C# PinmemberNico Encarnacion7-Mar-13 14:45 
AnswerRe: Wireless Sensor Node Simulation Time in C# PinmemberGerry Schmitz7-Mar-13 18:49 
GeneralRe: Wireless Sensor Node Simulation Time in C# PinmemberNico Encarnacion12-Mar-13 20:05 
GeneralRe: Wireless Sensor Node Simulation Time in C# PinmemberGerry Schmitz13-Mar-13 12:10 
QuestionExplicit type-casting of pointer PinmemberFlo_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 PinmemberGerry Schmitz7-Mar-13 12:23 
GeneralRe: Explicit type-casting of pointer PinmemberFlo_897-Mar-13 12:24 
AnswerRe: Explicit type-casting of pointer PinmemberMatt T Heffron7-Mar-13 12:34 
AnswerRe: Explicit type-casting of pointer Pinmemberharold aptroot7-Mar-13 21:57 
QuestionHow to highlight word in word document using C# [modified] PinmemberTridip Bhattacharjee7-Mar-13 3:56 
AnswerRe: How to highlight word in word document using C# PinmvpRichard MacCutchan7-Mar-13 5:13 
GeneralRe: How to highlight word in word document using C# PinmemberTridip Bhattacharjee8-Mar-13 1:46 
GeneralRe: How to highlight word in word document using C# PinmvpRichard MacCutchan8-Mar-13 2:16 
QuestionRe: How to highlight word in word document using C# PinmemberAlan N7-Mar-13 5:17 
AnswerRe: How to highlight word in word document using C# PinmemberTridip Bhattacharjee8-Mar-13 1:47 
GeneralRe: How to highlight word in word document using C# PinmemberAlan N8-Mar-13 3:12 
QuestionC# file access Pinmemberclassy_dog7-Mar-13 1:52 
AnswerRe: C# file access PinmvpDave Kreskowiak7-Mar-13 2:30 
AnswerRe: C# file access PinmemberMatt T Heffron7-Mar-13 8:49 
QuestionHow to use sql server database into oracle PinmemberArun kumar Gautam7-Mar-13 1:04 
AnswerRe: How to use sql server database into oracle PinmemberSimon_Whale7-Mar-13 1:14 
AnswerRe: How to use sql server database into oracle Pinmemberjschell7-Mar-13 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web01 | 2.8.140922.1 | Last Updated 23 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid