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

Search:

Type: Posts; User: NeilH

Page 1 of 5 1 2 3 4

Search: Search took 0.04 seconds.

  1. Replies
    51
    Views
    9,705

    If you know another language it prolly won't take...

    If you know another language it prolly won't take you too long. I would say 3-4 months if you already know Java.... It took me a couple of years to get a decent knowledge of c++, but that was on and...
  2. Thread: Spee conperison

    by NeilH
    Replies
    7
    Views
    1,206

    A simple way would be to use the clock()...

    A simple way would be to use the clock() function: http://www.cppreference.com/stddate_details.html#clock



    int nStart = clock() / CLOCKS_PER_SECOND;
    //Execute code to time here
    int nTime =...
  3. Replies
    9
    Views
    639

    You could clear the screen using #include...

    You could clear the screen using



    #include <iostream>
    using namespace std;
    //..
    void main()
    {
    //..
  4. Replies
    1
    Views
    1,325

    If the user will be modifying the shapes it's so...

    If the user will be modifying the shapes it's so much better to store the shapes as vectors (i.e. by storing the co-ordinates of the vertices).

    Having said that, it is easy enough to apply...
  5. Replies
    2
    Views
    1,665

    Use gluCylinder() to draw the cylinder, then...

    Use gluCylinder() to draw the cylinder, then apply the picture as a texture. If you want a full cylinder use gluDisk() to draw the disks on the ends.
    ...
  6. Replies
    11
    Views
    1,111

    Use unsigned char m = (unsigned char)x; for...

    Use
    unsigned char m = (unsigned char)x;
    for 0-255 range...

    The data format in the P5 data files is dictacted by the headers. The P5 data is just a sequence of bytes; sequences of either 2 or 1...
  7. Replies
    11
    Views
    1,111

    A quick search on Google brings up ...

    A quick search on Google brings up
    http://netpbm.sourceforge.net/doc/pgm.html

    According to that, P2 is a text version, whereas P5 is a raw binary data. If you want to perform the conversion from...
  8. Replies
    11
    Views
    1,111

    If you have an integer which is four bytes long,...

    If you have an integer which is four bytes long, and you do

    x & 255

    You are effectively stripping off the last three bytes and hence losing that data. And yes, that means that there is no way...
  9. Replies
    6
    Views
    692

    View Post

    <edited>
  10. Thread: Vectors

    by NeilH
    Replies
    17
    Views
    1,677

    I'm a terrible programmer, you don't have to tell...

    I'm a terrible programmer, you don't have to tell me. I was demonstrating why his error was occuring, and not re-writing his program...
  11. Thread: Vectors

    by NeilH
    Replies
    17
    Views
    1,677

    tempSize=strlen(tempS); should be tempSize...

    tempSize=strlen(tempS);

    should be

    tempSize = strlen(tempS.c_str());

    because strlen parameter asks for a character array, not a string object...
  12. Thread: Vectors

    by NeilH
    Replies
    17
    Views
    1,677

    Use cin.get() in a loop to retrieve the...

    Use cin.get() in a loop to retrieve the characters one after the other from the user. When you are satisfied that the sentence is complete (eg. when the user type a particular character) break out of...
  13. Replies
    6
    Views
    7,353

    Global variables are a lazy programmers...

    Global variables are a lazy programmers shortcut... As long as you don't define vast amounts of global variables you should be ok; it's not like a globally declared integer is going to cause harm
  14. Thread: Vectors

    by NeilH
    Replies
    17
    Views
    1,677

    #include #include using...

    #include <iostream>
    #include <vector>

    using namespace std;

    void main()
    {
    vector<char> myVector; //Create the vector
    myVector.push_back('h'); //Push an item onto the back
  15. Replies
    1
    Views
    708

    If you want to do it your way, you don't need the...

    If you want to do it your way, you don't need the header file "somefile.h", you can simply put:

    extern unsigned char SomeFunc();

    at the top of the file that is to use the function...

    The...
  16. Replies
    4
    Views
    530

    int nConverted = atoi(cStr.c_str()); You...

    int nConverted = atoi(cStr.c_str());

    You needed to pass the actual string buffer and not the string object...
  17. Replies
    4
    Views
    1,390

    You won't learn by getting us to do it for you :)

    You won't learn by getting us to do it for you :)
  18. Replies
    4
    Views
    880

    Or if you want to stick to the C way of doing it,...

    Or if you want to stick to the C way of doing it, use:

    strcpy(newFileText, buffer);

    You will have to make sure the size of newFileText is large enough to hold whats in buffer....
  19. Thread: strtok issue

    by NeilH
    Replies
    2
    Views
    685

    Yeah I should have stated that. The problem was...

    Yeah I should have stated that. The problem was because strtok doesn't like const char* as a search string since it modifies it.

    Thanks anyway tho
  20. Thread: strtok issue

    by NeilH
    Replies
    2
    Views
    685

    strtok issue

    I'm getting some very strange behaviour with strtok. I have a function containing this code:



    char* token = strtok(strFilter, " ,"); //Tokenize the filter string (comma separated list)
    ...
  21. Replies
    5
    Views
    1,373

    You need: EnableDocking(CBRS_ALIGN_ANY);...

    You need:

    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);

    This tells the dialog that it's to handle docking toolbars. Just setting the toolbar to be dockable isn't enough.
    ...
  22. Replies
    15
    Views
    1,747

    Bobwilson has posted some pretty decent stuff,...

    Bobwilson has posted some pretty decent stuff, helping a lot of people out. Just because he's said one "naughty" word doesn't make him all big and bad!

    The point of these forums is to help people...
  23. Replies
    3
    Views
    1,854

    int nBytes; while(nBytes = File->Read(pszBuffer,...

    int nBytes;
    while(nBytes = File->Read(pszBuffer, 512))
    {
    //Do something with the buffer here
    }

    That will read in 512 characters at a time. Read returns the amount of bytes read, so will...
  24. Replies
    4
    Views
    682

    char x = 4; int y = (int) x; Should work.

    char x = 4;
    int y = (int) x;


    Should work.
  25. Replies
    1
    Views
    645

    Call ShowWindow(SW_HIDE) on all toolbars. Then...

    Call ShowWindow(SW_HIDE) on all toolbars. Then when you want to make them visible, ShowWindow(SW_SHOW).

    //Hide the toolbar
    m_ToolBar.ShowWindow(SW_HIDE);
    //..
    //Re-show it...
Results 1 to 25 of 118
Page 1 of 5 1 2 3 4





Click Here to Expand Forum to Full Width

Featured