Results 1 to 6 of 6

Thread: C to C#

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    C to C#

    I'm afraid I do not know much about C...so how would I change this to C#?

    Code:
    #define MACH_2P         0
    #define MACH_STCPL      1
    #define UNQ_2P          2
    #define UNQ_STCPL       3

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: C to C#

    Quote Originally Posted by birthjay
    I'm afraid I do not know much about C...so how would I change this to C#?

    Code:
    #define MACH_2P         0
    #define MACH_STCPL      1
    #define UNQ_2P          2
    #define UNQ_STCPL       3
    apparenly its not used like that in C#
    http://msdn.microsoft.com/library/de...clrfdefine.asp
    if you use #define you cant really assign anything to it.


    Why dont you just declare constants instead?
    const int MACH_STPCL = 1 ...
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    Re: C to C#

    Thanks...

    What does this one mean?

    Code:
    #define CW_CCW_OPT 	0x0040

  4. #4
    New Member
    Join Date
    Oct 2004
    Location
    Florida
    Posts
    10

    Re: C to C#

    The 0x in front indicates that it is a hexadecimal (base 16) number. It's equivalent 64 in decimal. You should be able to use a const int just fine with that value.

  5. #5
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: C to C#

    Quote Originally Posted by birthjay
    Thanks...

    What does this one mean?

    Code:
    #define CW_CCW_OPT 	0x0040
    It's a preprocessor.
    basically when you use #define in C/C++, the compiler actually modifies your source code before compilation and REPLACES all the preprocessors with the numbers you've assigned to them. So when you compile your code, anywhere that you use CW_CCW_OPT, the compiler replaces it with the value of 0x0040 and THEN compiles your code.
    Im not sure, maybe there is a way to do it in C# as well
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Public const is the proper translation . The only difference is when you define a preprocessor like that in C it's file scoped but in C# if it's public then it's global to the whole app .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width