Search:

Type: Posts; User: Zarkhalar

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    24
    Views
    3,678

    Salem>Plus you seem to have generated an awful...

    Salem>Plus you seem to have generated an awful lot of code without any real testing, so any previous memory errors have gone undetected until now.

    Is there a way to test the new operator? I always...
  2. Replies
    24
    Views
    3,678

    I do have a grasp on how memory works :/ Some...

    I do have a grasp on how memory works :/
    Some parts I don't, sure. But I do create strings, I make pointers to them if I manipulate the code a lot, and I delete them when they are done.

    I do find...
  3. Replies
    3
    Views
    1,081

    Maybe it's built for and ran under windows? :P

    Maybe it's built for and ran under windows? :P
  4. Replies
    24
    Views
    3,678

    Argh, Got so far and now memory comes back to...

    Argh, Got so far and now memory comes back to haunt me. Theres a lot more to this, though.

    A segmentation fault occurs in my script if there are more than 2 lines in the configuration file that...
  5. Replies
    24
    Views
    3,678

    Err, yeah.. Whups.. Dunno why I tried to delete...

    Err, yeah.. Whups.. Dunno why I tried to delete temp o_0;

    So basically if I am playing with a dynamically allocated string, it's best to make a pointer and play with that pointer instead... ok,...
  6. Replies
    24
    Views
    3,678

    That's great, but now I can't delete temp. I...

    That's great, but now I can't delete temp.

    I need to go through a file and parse it out. If I go over 26 in my increases in the pointer, I can't delete it

    Soo, basically...


    file_buffer +=...
  7. Replies
    24
    Views
    3,678

    char* file_buffer = new char[filesize + 1]; ...

    char* file_buffer = new char[filesize + 1];
    fread (file_buffer, filesize, 1, handle);
    file_buffer[filesize] = '\0';
    file_buffer = strchr(file_buffer, '\n') + 1;
    file_buffer =...
  8. Replies
    24
    Views
    3,678

    Again, here is the real code, fully commented ...

    Again, here is the real code, fully commented


    fseek(handle, 0, SEEK_END); // Goes to the end possition in the file.
    int filesize = ftell(handle); // gets the length of the file.
    rewind...
  9. Replies
    24
    Views
    3,678

    All those things you just mentioned were mostly...

    All those things you just mentioned were mostly tests, except for the last codebox you put, which is an if statement in case something messes up in the program it gets rid of the memory first just in...
  10. Replies
    24
    Views
    3,678

    char* file_buffer = new char[filesize + 1]; ...

    char* file_buffer = new char[filesize + 1];
    fread (file_buffer, filesize, 1, handle);
    file_buffer[filesize + 1] = '\0';

    file_buffer = strchr(file_buffer, '\n') + 1;...
  11. Replies
    15
    Views
    2,718

    #include int main () { FILE* fp; ...

    #include <stdio.h>
    int main () {
    FILE* fp;
    if ((fp = fopen("filename", "r")) != NULL) {
    // File exists if this far is reached
    fclose(fp);
    }
    return 0;
    }
  12. Replies
    24
    Views
    3,678

    I did try that.. It didn't fix the issue... I...

    I did try that.. It didn't fix the issue...

    I am only using pointers to new char[]'s for this program, could that be an issue? Using only dynamic memory for strings?
  13. Replies
    24
    Views
    3,678

    A segmentation fault occurs... I wish I knew...

    A segmentation fault occurs...
    I wish I knew why, but I don't. -_-
    That's what I'm asking... x_X

    (It's a runtime issue, program compiles fine...)
  14. Replies
    24
    Views
    3,678

    Memory issue with new[] and delete[]

    fseek(handle, 0, SEEK_END);
    int filesize = ftell(handle);
    rewind (handle);
    char* file_buffer = new char[filesize + 1];
    fread (file_buffer, filesize, 1, handle);
    file_buffer =...
  15. Replies
    5
    Views
    1,103

    I ment all the strings, even though there wasn't...

    I ment all the strings, even though there wasn't the space for it, still printed out and all... with new, not talking about malloc

    I don't even know what std::string is :P I haven't played with...
  16. Replies
    5
    Views
    1,103

    Ahh, I thought that it didn't need that =) Thank...

    Ahh, I thought that it didn't need that =)
    Thank yas

    One question.. why would all the other ones work ok until this point?

    Edit: Also, what if I want to change the size of it? Delete it first...
  17. I don't even know what a vectore class is :P If...

    I don't even know what a vectore class is :P
    If its a windows thing, I don't do it :P
  18. Replies
    5
    Views
    1,103

    Problem with new :/

    char* file_location = new char;
    strncat (file_location, filename, strlen(filename) - strlen(basename(filename)));
    strcat (file_location, "../conf/sync.conf");
    file = new char;
    ...
  19. Replies
    6
    Views
    1,930

    I never use cout, or any of the iostream files....

    I never use cout, or any of the iostream files. Are they easier? o_0;
  20. Replies
    6
    Views
    1,930

    sscanf question

    Salem used sscanf in a snippet of code he gave me a bit ago, and it was interesting (I've always just done strstr parsing), but I need a bit more information about sscanf and I can't find it...
  21. Defining an Array's Length inside a Function possible?

    Basically the topic :/
    Is it possible to set an array in a function?
    I'm trying to get it so I can have an array in a class without a set size, and then when I'm ready to set it's size I can do so...
  22. Replies
    7
    Views
    2,613

    Yep, I know. But when I do a strlen() on any...

    Yep, I know. But when I do a strlen() on any other malloc'd variable it shows 0, while this one shows 8 o_0;
  23. Replies
    7
    Views
    2,613

    Thanks salem. Though every other malloc I use I...

    Thanks salem. Though every other malloc I use I don't add the +1 to the end, and I have no issues. This one also works fine when I remove the fclose() above it.

    Thantos: I get "8" returned when I...
  24. Replies
    7
    Views
    2,613

    malloc always setting length of 8?

    Why would it do that?
    Here's basically what it is...

    char* file_source;
    file_source = (char*) malloc (strlen("Whatever I want"));

    No matter what I do, setting a static int in malloc,...
  25. Replies
    3
    Views
    4,937

    That's what I'll be doing for this program, but...

    That's what I'll be doing for this program, but lets say some other program I make I want to be able to install in different directories. How do I know where to get the configuration file?

    For...
Results 1 to 25 of 28
Page 1 of 2 1 2