Search:

Type: Posts; User: melight

Search: Search took 0.00 seconds.

  1. Replies
    117
    Views
    15,201

    it's kind of hard to tell, you have int...

    it's kind of hard to tell, you have


    int merge(char str1[], int index1,char str2[],int index2, char result[], int index3);
    int merge_strings(char str1[], int index1,char str2[],int index2, char...
  2. Replies
    117
    Views
    15,201

    again what exactly you need to do with those two?...

    again what exactly you need to do with those two? You need to check while copying? Or you can first check, then copy (or vice versa)?
  3. Replies
    117
    Views
    15,201

    that's easy, in the second string copy the '\0'...

    that's easy, in the second string copy the '\0' in to the result array also, and only then return
  4. Replies
    117
    Views
    15,201

    You should be checking which string you are...

    You should be checking which string you are copying right now


    if(str1[index1]=='\0')
    {
    return index1;
    }
    else
    {
    result[index1]=str1[index1];
  5. Replies
    117
    Views
    15,201

    you simply need to cat two strings? lets say...

    you simply need to cat two strings? lets say "abc" merged with "bcd" will be "abcbcd", right?
  6. Replies
    117
    Views
    15,201

    Do you absolutely have to use recursion to do...

    Do you absolutely have to use recursion to do that?
    What exactly do you mean by 'merge'?
  7. Replies
    6
    Views
    3,943

    Tried that out, easier than I first assumed :D ...

    Tried that out, easier than I first assumed :D


    The library must be static, not sure it's an issue here though.

    Another thing I'd like to ask: can I hide functions in the library from the...
  8. Replies
    6
    Views
    3,943

    Well, to be frank, both. Never done either. Thats...

    Well, to be frank, both. Never done either. Thats why I want to see a basic example from which I can start rolling
  9. Replies
    6
    Views
    3,943

    static data structure in a library

    I don't even know if it makes any sense. Our sadist professor gave us this last exercise for this term. We should write a library that reassembles ip fragments (the fragmentation will be simulated...
  10. Ok, thanx a lot everyone, I got it working, a...

    Ok, thanx a lot everyone, I got it working, a function which replaces patt1 with patt2 in a given string and changes it's size if needed. It also takes care of special cases - empty second pattern,...
  11. there you go: #define _GNU_SOURCE #include...

    there you go:


    #define _GNU_SOURCE
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <string.h>

    char* strreplace(char *str, char *patt, char *repl);
  12. Note taken, doesn't really fix my problem though...

    Note taken, doesn't really fix my problem though (I've cut down the actual code where I do free() to something readable and relevant) .

    I've tried both things you've suggested laserlight, but...
  13. Going to check that out now

    Going to check that out now
  14. yeap, I want the function to change the string I...

    yeap, I want the function to change the string I am passing to it (which SHOULD be happening, coz I'm passing a pointer). The alg goes like this:



    while occurrence of patt found in str {
    ...
  15. problems with pointer and segfault in a very basic prog

    Hi, first post here :D
    I'm writing a program in C on Linux (Ubuntu) for a school project, one of the modules of the program is getting two arguments (patt and repl) and is also taking lines from...
Results 1 to 15 of 15