Salem_c's Profile User Rating: ****-

Reputation: 1678 Grandmaster
Active Posts:
3,180 (2.02 per day)
30-May 10
Profile Views:
Last Active:
User is offline Today, 01:43 PM

Previous Fields

Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
Icon   Salem_c has not set their status

Posts I've Made

  1. In Topic: Inventory System

    Posted 19 Sep 2014

    You're using 15 all over the place, where you should be using inventory.size()

    Further, you should start with an empty inventory, then do this
    Weapon w;
    while ( inputFile >> >> w.type >> w.damage ) {
      inventory.push_back( w );

    > inventory.erase(inventory.begin() + _toRemove);
    You'll find it easier if you use an iterator to scan the vector to begin with, rather than subscripts.
    Then you'll have an iterator pointing directly at the element you want to erase.
  2. In Topic: System call a command from within a program

    Posted 18 Sep 2014

    But system() does create a new process (or possibly more), it's just you don't see it happen in your code.

    FWIW, you could code most of what you're using dd for in 10 to 20 lines of code anyway, then the whole problem goes away.
  3. In Topic: Inventory System

    Posted 18 Sep 2014

    > 25 Weapon inventory[15]={0, 0, 0};
    I suggest you look at std::vector or maybe even std::list
  4. In Topic: System call a command from within a program

    Posted 18 Sep 2014

    > Is forking really necessary?
    That's for you to decide.

    Were you planning on having your code stick around to do something else after the dd had finished?
    If so, the answer is yes.
  5. In Topic: Dilating and Eroding advice

    Posted 18 Sep 2014

    Well you already know how to scan an image using x/y coordinates.

    Say for a current x/y there is a bright pixel you want to test for snow.
    The pixel above would be at image[y-1][x]
    The pixel to the left would be image[y][x-1]
    The pixel at the bottom right would be image[y+1][x+1]

    Be extra careful around the edges of the image. If you try y-1 on the first row, it will almost certainly crash.

My Information

Member Title:
void main'ers are DOOMED
Age Unknown
Birthday Unknown
Programming Languages:
C, C++, Perl, awk, various assemblers

Contact Information



Page 1 of 1
  1. Photo

    fromTheSprawl Icon

    07 Sep 2012 - 02:38
    Please read my thread. I kid! Just want to say your forum avatar is awesome. ^^
  2. Photo

    Salem_c Icon

    26 Dec 2010 - 01:36
    Do not PM me for 1:1 support, or to try to get me to read your threads.
Page 1 of 1