#define's Profile User Rating: -----

Reputation: 988 Master
Group:
Expert
Active Posts:
3,448 (2.18 per day)
Joined:
19-February 09
Profile Views:
22,187
Last Active:
User is offline Today, 06:51 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
LandRover
Dream Kudos:
0
Expert In:
C/C++

Latest Visitors

Icon   #define has not set their status

Posts I've Made

  1. In Topic: "this" string object

    Posted 19 Jun 2013

    I don't know why there are two constructors that are the same.

    08	  TString(const char *pText = 0); // default ctor
    09	  TString(const char *pText = 0);
    
    



    Mainly, there are two types of strings C++ strings and C strings. C strings use character arrays with a null character to terminate the string. Character Sequences


    It is useful sometimes to use a pointer to point to this array.

    char *pStr
    
    


    If the pointer equals 0, which is not a valid memory address, then you are to create an empty string.
  2. In Topic: Another one with a spiral, moving problems

    Posted 19 Jun 2013

    Hi, here, I've changed the variable names in the second section, and moved gotoxy and printf out of the if sections, and just changed y by 1 instead of four, as previously noted.

      right = 0;
      right_limit = 1;
    
      down = 0;
      down_limit = 1;
    
      left = 0;
      left_limit = 1;
    
      up = 0;
      up_limit = 1;
    
      for(i=0; i < count; i++)
      {
        gotoxy(x,y);
        printf("%d", number_list[i]);
        /* delay(500); */
    
        if(right < right_limit)
        {
          x+=4;
          right++;
        }
        else if (down < down_limit)
        {
           y++;
           down++;
        }
        else if(left < left_limit)
        {
           x-=4;
           left++;
        }
        else if (up < up_limit)
        {
          y--;
          up++;
          if(up == up_limit)
          {
            right = down = left = up = 0;
            right_limit += 1;
            down_limit  += 1;
            left_limit  += 1;
            up_limit    += 1;
          }
        }
      }
    
    



    This test is added because it is clear that the values should only be reset when up is finished.

          if(up == up_limit)
          {
    
          }
    
    
  3. In Topic: SFML network not sending correct values?

    Posted 19 Jun 2013

    The function Server_ListenForConnections() is in a separate thread but can access the global variables.

    So socket would be used for every thread.

    I would think about using a mutex around the section lines 36-42, the nextID get and increment.


    Don't know if this will be of any use.
    C++ Sfml 2.0 Made Easy
  4. In Topic: SDL and Winsock - Flashing images?

    Posted 19 Jun 2013

    The read set parameter will tell you if you can receive data without being blocked.

    if (FD_ISSET(s, &fdread)) {
    //recv(/*stuff*/);
    }
    
    



    The write set parameter will tell you if you can send data without being blocked.

    if (FD_ISSET(s, &fdwrite)) {
    //send(/*stuff*/);
    }
    
    



    select
  5. In Topic: Server code results in compile error.

    Posted 19 Jun 2013

    Hi, firstly, I would look at sending the null character at the end the string as well as the string.

My Information

Member Title:
Duke of Err
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Delta Quadrant
Years Programming:
12
Programming Languages:
C,C++,HTML,CSS

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Comments

Page 1 of 1
  1. Photo

    GryphonClaws Icon

    10 Jan 2013 - 01:15
    Thanks #define. I can't believe I missed such a simple detail.
  2. Photo

    raghav.naganathan Icon

    07 Nov 2012 - 20:40
    Dude...before your reputation changes, I would like to tell you that it(729) is a perfect cube :) Cheers :)
Page 1 of 1