Search:

Type: Posts; User: sameerc

Search: Search took 0.01 seconds.

  1. Replies
    11
    Views
    42,151

    thanx dave.... but this finally seemed to...

    thanx dave....

    but this finally seemed to work....i guess it was the (char *) before the malloc that was needed


    c3 = (char *)malloc(strlen(c1) + strlen(c2) +1);
    strcpy(c3,c1);
    strcat(c3,c2);
  2. Replies
    11
    Views
    42,151

    hmm...then i guess i thought up the wrong...

    hmm...then i guess i thought up the wrong reason....

    i did allocate a lot of space....

    let me paste some of my actual code... (you will see there's hardly any difference between the example...
  3. Replies
    11
    Views
    42,151

    tried but did not work... i think it's cos c2...

    tried but did not work...

    i think it's cos c2 does not have an explicit '\0' character.....
    so it crashes when it encounters the strcat() function...

    -sameer
  4. Replies
    5
    Views
    2,220

    concatenating a char * without "\0"

    haven't used C/C++ in a while....so this might be really simple for most of you....

    can someone please tell me how to concatenate two char * strings?
    (one of them is const char* and the other one...
  5. Replies
    11
    Views
    42,151

    thanx a lot for your reply.... however, i ran...

    thanx a lot for your reply....

    however, i ran the code that you listed in a MS vc++ environment, and it gives me an error:

    error C2440: 'initializing' : cannot convert from 'void *' to 'char *'...
  6. Replies
    11
    Views
    42,151

    that doesn't work here cos I guess the getenv...

    that doesn't work here cos I guess the getenv function returns a pointer to the whole PATH but the PATH does not have a defined '\0' character at the end....
  7. Replies
    11
    Views
    42,151

    Concatenation of strings as char pointers

    haven't used C in a while....so this might be really simple for most of you....

    can someone please tell me how to concatenate two char * strings?

    eg.
    char * c1 = "SYSTEM PATH = "
    char *c2 =...
Results 1 to 7 of 7