Search:

Type: Posts; User: Jorl17

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    9
    Views
    1,822

    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,822

    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,859

    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
    5,272

    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
    5,272

    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
    5,272

    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
    1,020

    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. 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...
  13. Replies
    11
    Views
    1,787

    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.
  14. Replies
    9
    Views
    1,142

    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...
  15. Replies
    4
    Views
    2,447

    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...
  16. Replies
    5
    Views
    2,325

    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
  17. Replies
    17
    Views
    2,429

    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...
  18. Replies
    12
    Views
    2,404

    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...
  19. Thread: Text Alignment

    by Jorl17
    Replies
    5
    Views
    22,315

    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...
  20. Thread: error #2605

    by Jorl17
    Replies
    6
    Views
    1,666

    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...
  21. Thread: error #2605

    by Jorl17
    Replies
    6
    Views
    1,666

    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.
  22. Replies
    29
    Views
    28,313

    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...
  23. Replies
    7
    Views
    1,818

    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:
    ...
  24. Replies
    29
    Views
    28,313

    Ah, so we're discussing if memset is in fact...

    Ah, so we're discussing if memset is in fact portable with all POD types, right?

    But if we're not into arrays anymore, then what's the purpose of using memset? Using the assignment operator is...
  25. Replies
    29
    Views
    28,313

    Does it really matter all that much? If we use...

    Does it really matter all that much? If we use the {0} scheme, it gets initialized properly. If we want to see if it "hasn't been changed" we'd just compare it with (float)0, which would give you...
Results 1 to 25 of 79
Page 1 of 4 1 2 3 4