Search:

Type: Posts; User: Jorl17

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    9
    Views
    1,527

    I just let the argument name out. In the case I...

    I just let the argument name out. In the case I want to keep it in anyway, I define a macro:


    #define UNUSED(x)

    Then I would do:


    data_free(void *event_data, void * UNUSED(client_data))
  2. Replies
    9
    Views
    1,527

    I'd say that it is used to avoid a compiler...

    I'd say that it is used to avoid a compiler warning about client_data not being used. However, there are much simpler and beautiful approaches to that...
  3. Replies
    3
    Views
    2,022

    You only get a floating point result if your...

    You only get a floating point result if your operands to the division operator are floats themselves[1]. So:


    (((float)AddCountRight) / ((float)TotalAddProb) *100.0f)

    See if that works. It...
  4. I only looked at the 10 last lines. Don't you...

    I only looked at the 10 last lines. Don't you think that it will return false if you never effectively look for '/' or '.' in the string? You're basically comparing the ASCII values of those two...
  5. I guess it means that you ask the user to enter a...

    I guess it means that you ask the user to enter a number and check if it really is a number, so say that:



    But I could be misinterpreting... Though I don't get the name of the function... Note...
  6. Replies
    8
    Views
    4,373

    Meh, here's how I would do it: ...

    Meh, here's how I would do it:


    #include<iostream>
    using namespace std;

    int main() {
    int num=3, checknum, remainder, answer=1;
    do {
    checknum=2;
  7. Replies
    8
    Views
    4,373

    Well then, edit your first post and try to do...

    Well then, edit your first post and try to do your best, please. Indent how you like, but code tags are mandatory (haven't you read the forum post that talks about that? You know, the one with that...
  8. Replies
    8
    Views
    4,373

    Please!...My eyes hurt!...Indent your code!! Put...

    Please!...My eyes hurt!...Indent your code!! Put code tags around it!

    Hurry, I think I won't survive it...
  9. Replies
    5
    Views
    860

    It really depends, what error/mistake are you...

    It really depends, what error/mistake are you talking about?

    1. If you're going to point to a double, use a pointer to a double (double* myDoublePtr).

    2. If you're going to screw it up anyway,...
  10. I get what you mean. Maybe some form of IPC? ...

    I get what you mean. Maybe some form of IPC?

    If not, check this (old) article, it may be useful:

    Embedding Python in Your C Programs | Linux Journal

    edit: It's actually 0-255, which are all...
  11. I haven't read your code in detail yet. Like you...

    I haven't read your code in detail yet. Like you said, execl replaces the current process image, which means that nothing past execl will be executed, unless it fails. It's similar to "invoking a...
  12. Yes, indeed, hence why I said I was talking more...

    Yes, indeed, hence why I said I was talking more about C than about C++ and, specifically, about my particular learning case. C++ makes all that transparent, like you said, it makes it beautiful.
    ...
  13. Let me add that when I first learned similar...

    Let me add that when I first learned similar things, I had quite a lot of trouble.

    The fact is that, for someone to clearly understand (I'm talking more C than C++) the methods behind saving...
  14. On Unix-y systems, you can run your script with...

    On Unix-y systems, you can run your script with one function of the exec() family (for instance, my favourite, execvp()) and then you can use wait() (or waitpid()) to get the exit status (return...
  15. Replies
    11
    Views
    1,503

    Why not try CodeBlocks with its bundled MingW or...

    Why not try CodeBlocks with its bundled MingW or with a downloaded MingW? It's Open-Source and it has very good features. These days I'm all QtCreator, though.
  16. Replies
    9
    Views
    961

    I've heard the term signature when talking about...

    I've heard the term signature when talking about calling conventions or when talking about the output of CRC32, checksum and other similar algorithms applied to the whole or portions of raw binary...
  17. Replies
    4
    Views
    2,092

    Thinking about it, I can see a possible theory --...

    Thinking about it, I can see a possible theory -- which may be severely flawed given that I have many questions.

    Say you have a Base Application.

    Base Application binds to Port. This...
  18. Replies
    5
    Views
    1,970

    Then, for starters, if none of the advice in here...

    Then, for starters, if none of the advice in here works, you should


    man 3 ncurses
  19. Replies
    17
    Views
    2,046

    Sorry to but in, but I have to agree. I'm a...

    Sorry to but in, but I have to agree.

    I'm a young hobbyist programmer myself and I've worked with Python, PHP, MySQL, Java, Javascript, HTML, etc...but mostly Assembly, C and C++. Maybe it is...
  20. Replies
    12
    Views
    1,924

    May I suggest getting used to running your code...

    May I suggest getting used to running your code through valgrind? It'll help you spot many of these errors, I love it! With all the modifications I mentioned, your code resulted in perfect crash-free...
  21. Thread: Text Alignment

    by Jorl17
    Replies
    5
    Views
    14,508

    There's probably an easier way to do it, but I...

    There's probably an easier way to do it, but I couldn't find it.

    refer to: C-equivalent of the 'setw' function - efreedom which looks for a C version of the std::setw function found in C++. Also...
  22. Thread: error #2605

    by Jorl17
    Replies
    6
    Views
    1,365

    First, don't split a string ("this is a string")...

    First, don't split a string ("this is a string") across lines.

    Second, if you're printing a string, it should "Look like this", and not ""like this" or "like this "" " " " " " " " " """

    So...
  23. Thread: error #2605

    by Jorl17
    Replies
    6
    Views
    1,365

    I see two (or three, it really depends on...

    I see two (or three, it really depends on repetition) things wrong with your code. I believe that you should be able to see them for yourself.

    Throw ideas at the forum wall.
  24. Replies
    29
    Views
    26,517

    Ah, you're right, dword-by-dword or...

    Ah, you're right, dword-by-dword or qword-by-qword indeed, it's faster. However, I think that we should rely on the fact that our compiler produces fast code for those operators (and it probably...
  25. Replies
    7
    Views
    1,359

    Yes, NASM is the thing. May I also suggest...

    Yes, NASM is the thing.

    May I also suggest that you try to look at the disassembly of your C/C++ programs? Or at the output of, say gcc -S if you're with it? (or gcc -S -masm=intel).

    edit:
    ...
Results 1 to 25 of 85
Page 1 of 4 1 2 3 4