Search:

Type: Posts; User: creek23

Search: Search took 0.01 seconds.

  1. Replies
    19
    Views
    5,034

    Finally wrote the function I wanted to make with...

    Finally wrote the function I wanted to make with help of pass-by-reference.

    The code below would allow to load a ASCII file content (hopefully with binary file too) into an uninitialized string.
    ...
  2. Replies
    19
    Views
    5,034

    Thanks Salem! That was actually helpful. Here's...

    Thanks Salem! That was actually helpful. Here's the working code below.




    #include <stdio.h>
    #include <stdlib.h>

    void my_strcpy(char **dest, char *src) {
    *dest = (char *)...
  3. Replies
    19
    Views
    5,034

    Saying there is none and saying you can simulate...

    Saying there is none and saying you can simulate it is a contradicting statement. Just as saying there no pointers in Java but you can fake one.

    Of course, I'm aware that C uses pointers to fake...
  4. Replies
    19
    Views
    5,034

    already added 1 -> malloc(sizeof(strlen(src) +...

    already added 1 -> malloc(sizeof(strlen(src) + 1));

    still the same. app crashes. :(
  5. Replies
    19
    Views
    5,034

    I actually just forgot the **. edited the post,...

    I actually just forgot the **. edited the post, please check again.
  6. Replies
    19
    Views
    5,034

    I'm actually not after the replication of the...

    I'm actually not after the replication of the functionality of strcpy nor strdup. I'm after the passing-by-reference in C.

    Exactly how do I do that? I'm getting segmentation fault with this test....
  7. Replies
    19
    Views
    5,034

    how to retain an allocated memory

    I'm trying to make my own strcpy. A version of strcpy that will allow this,



    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main(void) {
    char *content1;
Results 1 to 7 of 7