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

Reputation: 1918 Grandmaster
Group:
Mentors
Active Posts:
3,761 (1.99 per day)
Joined:
30-May 10
Profile Views:
41,590
Last Active:
User is offline May 17 2015 11:37 PM
Currently:
Offline

Previous Fields

Country:
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:
0
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);
    042	 
    043	    std::cout << "Username: ";
    044	    std::cin >> u;
    045	    std::cout << "Password: ";
    046	    std::cin >> p;
    047	 
    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 {
      Folder,
      File
    } 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 x.v.file.data

    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:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Programming Languages:
C, C++, Perl, awk, various assemblers

Contact Information

E-mail:
Private

Comments

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