Convert from string to int.

This is a discussion on Convert from string to int. within the C++ Programming forums, part of the General Programming Boards category; I suggest reaching for a std::vector<int>. You can then also return it from the function, or, if appropriate, it might ...

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,283
    I suggest reaching for a std::vector<int>. You can then also return it from the function, or, if appropriate, it might be more suitable as a member variable instead. The alternative does involve new[], but I would not use it unless I really have to.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Pass an address of a struct (or class) allocated on the heap around then, (as a function arg)

  3. #18
    Registered User
    Join Date
    May 2007
    Posts
    12
    Thank you for your suggestions :-)

    I eventually solved it by creating an int pointer.

    ie
    Code:
    int * temp;
    then further down just said
    Code:
    temp = new int[value];
    Thanks for your help - my assignment (a media player) is almost now complete, got some bugs in it that I'm struggling with but i'll start another thread :-)

    Thanks again!
    Leigh

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 08:19 AM
  2. Replies: 8
    Last Post: 04-25-2008, 03:45 PM
  3. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 01:05 PM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 12:58 PM
  5. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21