Search:

Type: Posts; User: Raptor007

Search: Search took 0.01 seconds.

  1. Correct me if I'm wrong, but isn't scanf a...

    Correct me if I'm wrong, but isn't scanf a dangerous way to read in a string? Wouldn't it have the same issue as gets? I'm not seeing a length arguement (I guess you could try something like...
  2. Thread: Need ur help

    by Raptor007
    Replies
    7
    Views
    1,703

    I could be mistaken, but I'm pretty sure the...

    I could be mistaken, but I'm pretty sure the direct manipulation required to partition and format is very operating system dependent. You might get better help if you gave us your OS and compiler. ...
  3. Replies
    4
    Views
    1,327

    Hehe, you're asking that in this section? That's...

    Hehe, you're asking that in this section? That's kind of like going to a dog show and asking if anyone there likes dogs...

    (Yes. I like C.)
  4. Replies
    4
    Views
    6,294

    Try rebooting your machine, in case some program...

    Try rebooting your machine, in case some program is holding that file open and refusing to let other programs access it (not too likely, but just in case).

    Also, what OS and compiler are you using?
  5. Replies
    4
    Views
    6,294

    It's safest to specify whether you're reading...

    It's safest to specify whether you're reading text or binary, using "rt" or "rb", rather than leaving it to your compiler to decide. Same with writing, "wt" or "wb". But this isn't really your...
  6. Replies
    16
    Views
    2,316

    I haven't put it into my compiler to check it,...

    I haven't put it into my compiler to check it, but it looks like you've got the hang of it so far.

    EDIT: If you check a malloc and find there wasn't enough memory, you should probably do...
  7. I agree, it's very unclear what you're trying to...

    I agree, it's very unclear what you're trying to do. Perhaps you were looking for something like rewind?
  8. Thread: Delte file

    by Raptor007
    Replies
    17
    Views
    2,303

    By the way... why are you writing plain text to a...

    By the way... why are you writing plain text to a .exe file?
  9. Thread: Delte file

    by Raptor007
    Replies
    17
    Views
    2,303

    Sometimes the easiest way to loosen something's...

    Sometimes the easiest way to loosen something's grip on a file is to just reboot the machine. If that fails, you could try a virus scan. I use http://housecall.trendmicro.com because it's free and...
  10. Replies
    10
    Views
    11,343

    True, this will make it work, but it's no longer...

    True, this will make it work, but it's no longer doing anything in parallel.

    Although, I've never heard of a statement that simple setting everything up in parallel. Even MPI, which is pretty...
  11. Thread: File I/O

    by Raptor007
    Replies
    6
    Views
    1,344

    Yeah Machoscorpion, that's probably how I'd do it...

    Yeah Machoscorpion, that's probably how I'd do it too. For just checking if the file exists, I think read-append and just plain read will have the exact same effect, but since we have no intention...
  12. Thread: File I/O

    by Raptor007
    Replies
    6
    Views
    1,344

    This is a command-line program looking for...

    This is a command-line program looking for arguements. Hitting Run in the MSVC environment won't give it any arguements by default (maybe someone else knows a way to do that).

    You can open a...
  13. Replies
    13
    Views
    1,878

    I'm sorry about that, you're right that I...

    I'm sorry about that, you're right that I shouldn't have used gets in my example. My post was mainly supposed to show that he needs memory allocated to use any such function (giving some code to...
  14. Replies
    13
    Views
    1,878

    What is wrong with you, and what are you talking...

    What is wrong with you, and what are you talking about?
    I even left out the cast, just for you.

    Btw, it was nice of you to post to this guy's thread just to flame me and not even let him know...
  15. Replies
    13
    Views
    1,878

    It sounds like he's used to other languages which...

    It sounds like he's used to other languages which do not require you to set a maximum string size initially. This is a familiar feeling, I've been there too. :)

    The problem is, gets() and...
  16. In your example, no, I wouldn't use casting. I...

    In your example, no, I wouldn't use casting. I use casting when void * (or void **, void ***, etc) are involved. It's especially useful when lots of code separates the declarations from the actual...
  17. Replies
    7
    Views
    1,646

    Something you might not be used to... all strings...

    Something you might not be used to... all strings in C are arrays of characters, with a null terminator character telling it when the string ends.

    Therefore this:


    char string[100];
    ...
  18. Well, my idea behind safefree was originally...

    Well, my idea behind safefree was originally this:


    void safefree (void **pointerPointer) {

    if (*pointerPointer) {

    free (*pointerPointer);
    *pointerPointer = NULL;
    }
  19. Replies
    14
    Views
    1,387

    It doesn't have to be an array, I just figured...

    It doesn't have to be an array, I just figured you had an array of values.

    Here it is with just plain sequential integers:


    // Loop through all values in the array.
    for (i = 0; i < max; i++)...
  20. Replies
    12
    Views
    1,994

    You could try something similar in C: struct...

    You could try something similar in C:


    struct Array {
    void **elements;
    int size;
    };
  21. Replies
    7
    Views
    1,646

    Try this for starters.

    No, no, no... that would print the characters backwards, he wants to print the LINES backwards with each string intact.

    Something like this should do it:


    #include <stdio.h>
    #include...
  22. Replies
    14
    Views
    1,387

    Try something like this: // Loop through...

    Try something like this:



    // Loop through all values in the array.
    for (i = 0; i < size; i++) {

    // Print the current value.
    printf ("%i", array[i]);
  23. Fixed it!! I think.

    I think I fixed it! :)

    I have a function that copies a string to a new size, and I was using it with strlen (oldStr) to copy strings down to the minimum size needed. Unfortunately, my malloc was...
  24. Ah... I started suspecting it wasn't that...

    Ah... I started suspecting it wasn't that particular buffer when commenting out the free statement gave me errors in the free statements that are inside fflush and printf. Plus it's a pretty...
  25. (C, Malloc, Free) Help! Access violation and/or damage after normal block!!

    Hey, I'm writing a C program that uses a whole lot of malloc and free commands. I've run into a snag where partway through execution, it fails on a free command. However I've checked thoroughly by...
Results 1 to 25 of 25