Search:

Type: Posts; User: MTK

Page 1 of 9 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: gets() not so bad

    by MTK
    Replies
    93
    Views
    11,569

    I didn't say that I thought segmentation faults...

    I didn't say that I thought segmentation faults are fine. I just said that I can find and fix them without harming my system.
  2. Thread: gets() not so bad

    by MTK
    Replies
    93
    Views
    11,569

    One little project I did involved a lot of...

    One little project I did involved a lot of dealing with allocated memory and it tried to write to places it wasn't supposed to all the time.

    The worst that happened was just a little message in...
  3. Thread: gets() not so bad

    by MTK
    Replies
    93
    Views
    11,569

    This whole conversation reminds me of this quote:...

    This whole conversation reminds me of this quote:



    And that's why I think that things like memcpy, etc should NOT be removed. Unlike gets(), they CAN be safe if used right.
  4. Thread: gets() not so bad

    by MTK
    Replies
    93
    Views
    11,569

    I agree that gets() must be gotten rid of. Unless...

    I agree that gets() must be gotten rid of. Unless you give it an infinitely large buffer, it's always possible for the user to enter a line longer than the buffer.

    Besides, is this:

    ...
  5. Replies
    5
    Views
    10,112

    Yeah, that's correct. Without the "!= EOF" part...

    Yeah, that's correct. Without the "!= EOF" part it checks if it's not 0 instead of not EOF (probably -1).

    And as you see the assignment operator can be used within an expression! It assigns the...
  6. Replies
    5
    Views
    10,112

    BAD!!! You cannot use a "char" because each...

    BAD!!!

    You cannot use a "char" because each byte in the file fills a whole "char". How do you think the EOF can be represented then? You have to use an int instead. It's filled with the values...
  7. I have almost the exact same problem. I really...

    I have almost the exact same problem.

    I really suck at reading other people's code :(
  8. Replies
    4
    Views
    6,096

    I guess that malloc() is the only reasonable way,...

    I guess that malloc() is the only reasonable way, as far as I can think of.

    Another idea might be to use fixed-size char arrays in the structs, but that means that there will be a needless...
  9. Thread: Function-doubt

    by MTK
    Replies
    9
    Views
    1,494

    I know, and I would never use NULL for anything...

    I know, and I would never use NULL for anything but pointers.

    I was just trying to explain it to the original poster that the concepts of "NULL" and "void" are completely unrelated.
  10. Thread: Function-doubt

    by MTK
    Replies
    9
    Views
    1,494

    NULL == 0. Think of it this way: #define NULL...

    NULL == 0. Think of it this way:

    #define NULL 0

    After running this code:

    int var;
    var = NULL;

    "var" will contain "0".
  11. Replies
    4
    Views
    6,096

    Here's a better example: struct datafile {...

    Here's a better example:


    struct datafile {
    char *str1;
    char *str2;
    int number;
    linkedlist *list;
    }
  12. Replies
    4
    Views
    6,096

    Fill in a struct from file

    What would be the best way to fill in a struct with data from a file?

    Here are my two main proplems:

    1) How to parse the data out of the file?

    It will be in this format:


    <attribute>...
  13. Replies
    8
    Views
    5,648

    Haven't noticed that. :)

    Haven't noticed that. :)
  14. Replies
    8
    Views
    5,648

    I wrote this: #include #include...

    I wrote this:


    #include <stdio.h>
    #include <dirent.h>
    #include <sys/stat.h>

    int main()
    {
    DIR *dir = opendir(".");
  15. It should be C:\\>. \n - newline \t - tab ...

    It should be C:\\>.

    \n - newline

    \t - tab

    \\ - backslash
  16. Replies
    8
    Views
    5,648

    This works, it lists all the files in the current...

    This works, it lists all the files in the current dir:


    #include <stdio.h>
    #include <dirent.h>

    int main()
    {
    DIR *dir = opendir(".");
    struct dirent *dirent;
  17. Replies
    8
    Views
    5,648

    Cross-platform isn't really necessary, I just...

    Cross-platform isn't really necessary, I just thought maybe something existed.

    I'll check out opendir().
  18. Replies
    8
    Views
    5,648

    File/Directory manipulation

    I would like to be able to do file/directory manipulation in C.

    Simple and cross-platform would be great, otherwise it should work in Linux.

    I tried searching the wep and looking at some man...
  19. Thread: Compiler error

    by MTK
    Replies
    1
    Views
    691

    Compiler error

    $ g++ -c -lX11 -I /usr/include/cairo -lcairo src/TopLevelWindow.cpp
    src/TopLevelWindow.cpp: In constructor ‘TopLevelWindow::TopLevelWindow(Application*, Dimension, std::string)’:...
  20. Replies
    22
    Views
    6,680

    That reminded me that the python interpreter...

    That reminded me that the python interpreter makes a pretty good calculator too, and you can get history with the up key.
  21. Replies
    22
    Views
    6,680

    Qalculate! is pretty good. EDIT: I just got...

    Qalculate! is pretty good.

    EDIT: I just got SpeedCrunch to try, it's a very nice concept compared to most calculator applications that try to emulate a physical calculator.

    And I saw a pretty...
  22. Thread: Text Editor

    by MTK
    Replies
    4
    Views
    1,256

    What? Are you writing code in a word processor?!?!

    What? Are you writing code in a word processor?!?!
  23. Replies
    4
    Views
    3,211

    XGetGeometry might be just what I want. I'll try...

    XGetGeometry might be just what I want. I'll try it later.
  24. Replies
    21
    Views
    3,704

    It's supposed to be cout!

    It's supposed to be cout!
  25. Replies
    4
    Views
    3,211

    Xorg in Linux.

    Xorg in Linux.
Results 1 to 25 of 202
Page 1 of 9 1 2 3 4