CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: ninja9578

Page 1 of 68 1 2 3 4

Search: Search took 0.40 seconds.

  1. Replies
    4
    Views
    1,536

    Re: Looking for chars in string.

    You are looking for the index where the string changes from one char to another?


    std::string mystring = "ggaagaaag";
    size_t index = 0;
    char last = '\0';
    for(std::string::iterator i =...
  2. Replies
    67
    Views
    19,776

    Re: Area and volume of cylinder

    Personally, I see two ways to do this: method overloading, or templates:


    class cylinder_calc {
    public:
    static int get_volume(int r, int h){ ... }
    static float get_volume(float r,...
  3. Re: Question for Rock Paper Scissors game program

    try this


    enum SELECTION {
    ROCK = 1,
    SCISSORS = 2,
    PAPER = 3,
    LIZARD = 4,
    SPOCK = 5
    };
  4. Re: [RESOLVED] unsigned char c = -1; // c has value 255, why is that?

    If you use -Wall, you should get a warning when losing precision like that.
  5. Replies
    14
    Views
    4,342

    Re: Cloning an object

    There sure is, but it's not pretty.


    foobar * myobject = new foobar();
    foobar * clone = new foobar(); //allocate the space for it, don't use malloc
    memcpy(clone, myobject, sizeof(foobar));
    ...
  6. Poll: Re: What end is the majority of your professional work in?

    That would be interesting, I'll bet different languages have different extent of where people code, but I'm just curious about C++.
  7. Poll: Re: What end is the majority of your professional work in?

    Darn, I forgot a third category. Hmm, if you do embedded coding, check backend.
  8. Poll: What end is the majority of your professional work in?

    Debating with someone about what the average programmer does for a living. Im sure that it's always been backend code since it's the most complex, with today's climate of cloud computing, and the...
  9. Re: Are there any good multi-platform IDEs for C++ w/refactoring support?

    I agree with authoritybuilder.

    :P

    Eclipse has a C++ plugin, why not just use that?
  10. Thread: Jpeg Decoder

    by ninja9578
    Replies
    2
    Views
    4,167

    Re: Jpeg Decoder

    libjpeg-turbo is a branch of libjpeg6 that has dramatically increased performance. It's used by Firefox, Chrome, Fedora...
  11. Replies
    1
    Views
    1,081

    Simplest 3D physics engine

    I am just looking for advice, what is the simplest 3D physics engine that you have used, that works well?

    All I need to be able to represent is a spherical ground (planet), one or more...
  12. Replies
    10
    Views
    13,303

    Re: what is the type specifier for boolean?

    A handy little function:


    inline const char * btoa(bool b){
    return b ? "true" : "false";
    }

    inline char btoc(bool b){
    return b ? 'T' : 'F';
    }
  13. Replies
    4
    Views
    2,048

    Re: issue with asm intel syntax

    well, for one, your method declaration expects a void * to be returned and you are returning and HMODULE.
  14. Replies
    3
    Views
    1,327

    Re: Texting Script

    No, you would need the SMSC to send the messages to your server, you have no control over that. Sorry, you'll have to think of something else, it's not possible to man-in-the-middle a text message.
  15. Re: Reading in data from file in certain format

    I never ever recommend writing your own file format, put it in text format and use XML, JSON, YAML, INI... These formats exist for a reason :)
  16. Re: Newbie question about different languages and what they can do (mainly C++)

    It's not true that Android dev is done in Java. The SDK is java, most apps are written in it, but the system supports libraries that can be written in any language. Games are usually written in C++...
  17. Replies
    5
    Views
    8,962

    Re: Convert 2-byte array to short int

    A problem with your code lies here

    g_Data[iter] = (shortBuf[1] << 8) | shortBuf[0];
    because shortBuf is an array of chars, the << 8 will move everything past the last bit. << keeps the type what...
  18. Replies
    5
    Views
    8,962

    Re: Convert 2-byte array to short int

    A problem with your code lies here

    g_Data[iter] = (shortBuf[1] << 8) | shortBuf[0];
    because shortBuf is an array of chars, the << 8 will move everything past the last bit. << keeps the type what...
  19. Re: Problem With Declaring Variables In A Function

    Yep, the stack space has to be allocated all at once in the beginning of the scope. I'm very surprised that Visual C still does that though, almost all other C compilers allow you to have C++ style...
  20. Re: [Newbie] SIP parser and header-file including (using sofia-sip)

    You need to link to the sip library binaries.

    g++ -o parser -I/usr/include/sofia-sip-1.12 parser.cpp -lsofia-sip-1.12
  21. Replies
    4
    Views
    1,512

    Re: Base Class's function gets called

    Was the code edited since laserlight's post? Because it looks like it's declared const to me.
  22. Replies
    1
    Views
    1,045

    Re: [C] parsing EOF

    Check out the fscanf function
    http://www.cplusplus.com/reference/clibrary/cstdio/fscanf/
  23. Replies
    2
    Views
    1,234

    Re: incrementing iterator

    ++it means this:

    increment the iterator
    return the new location

    it++ means this:
    copy the iterator
    increment the original iterator
    return the copy
  24. Replies
    3
    Views
    1,538

    Re: reading a file to a vecto/struct

    Based on the name of the thread I can tell it likely had something to do with serialization. As always, I would recommend using a standard serialization format like json or xml instead of writing...
  25. Replies
    3
    Views
    857

    Re: Strangley placed else

    It does nothing. Most likely there to remind the programmer that there is other cases besides the two specified.
Results 1 to 25 of 1698
Page 1 of 68 1 2 3 4





Click Here to Expand Forum to Full Width

Featured