Link to home
Start Free TrialLog in
Avatar of Carl3003
Carl3003

asked on

i cant make casting working...


      char dir_str[100];
                dir_str[0] = '\0';
      strcat(dir_str, "/dev/");
      strcat(dir_str, (char*)utbufp->ut_line);  // right here i get error mesg..

The code would  not work even if i replace   strcat(dir_str, (char*)utbufp->ut_line);   with
strcat(dir_str, utbufp->ut_line);  
Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of efn
efn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Carl3003
Carl3003

ASKER

Segmentation Fault (core dumped)

struct utmp {
        char ut_user[8];                /* User login name */
        char ut_id[4];                  /* /etc/inittab id(usually line #) */
        char ut_line[12];               /* device name (console, lnxx) */
        short ut_pid;                   /* short for compat. - process id */
        short ut_type;                  /* type of entry */
        struct exit_status ut_exit;     /* The exit status of a process */
                                        /* marked as DEAD_PROCESS. */
        time_t ut_time;                 /* time entry was made */
};

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks but i made it working..:-)