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

Reputation: 1919 Grandmaster
Active Posts:
3,761 (1.96 per day)
30-May 10
Profile Views:
Last Active:
User is offline Aug 23 2015 01:23 AM

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: parsing tags

    Posted 17 May 2015

    Yes you can, but you need to do a couple of things.

    1. Use an ostringstream to convert the integer into a string.
    2. Alter your string insertion, which at present assumes that the integer is only a single character.
  2. In Topic: parsing tags

    Posted 17 May 2015

    Start with
    char count = '0';
    It'll work for a while, but when you get to more than 10 links, you're going to need another plan.
  3. In Topic: C program crashes when exiting

    Posted 17 May 2015

    What is wrong is that you're ignoring the return result of realloc.

    What is also wrong is that if realloc moves the memory to somewhere else, you have no way of returning the modified pointer back to main.

    Further. an expression like (sizeof(struct Customer)) * 2 doesn't make the memory twice as big as it was before. You need to track how much memory you need yourself.
  4. In Topic: c++ Login system help

    Posted 16 May 2015

    040	    LoadUn(usrnlist);  
    041	    LoadPw(pwlst);
    043	    std::cout << "Username: ";
    044	    std::cin >> u;
    045	    std::cout << "Password: ";
    046	    std::cin >> p;
    048	    if((ValidareUserInput(usrnlist,u,pos))&&(ValidareUserInput(pwlst,p,pos)))
    049	    {
    050	        std::cout << "OK!" << std::endl;
    051	        Display(namelst,pos);
    052	        Display(serielst,pos);
    053	        Display(nrlst,pos);
    054	        Display(cnplst,pos);

    Well it's a hazard when you read only part of the data.
    You need to load your nrlst and cnplst vectors.

    Next time you get an assert fail, run the code in the debugger and it will point you directly at a line of code responsible from the assert. With minimal looking around at variables, you would find this out quite quickly.
  5. In Topic: Binary directory tree problem of implementing it

    Posted 16 May 2015

    Well you can do this without any casting at all.
    typedef enum TIP {
    } TIP;
    typedef struct node {
      char *name;
      TIP ident;
      union {
        struct {
          struct node *left,*right;
        } folder;
        struct {
          int data;
        } file;
      } v;
    } NODE;

    So for example,
    if x.ident is Folder, then you would access x.v.folder.left
    if x.ident is File, then you would access

    You can do the same without a union by writing out each variant of the structure as you have done.
    But you need to make sure that the common members are listed in the same order in each variant.

My Information

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

Contact Information