Search:

Type: Posts; User: smokeyangel

Page 1 of 20 1 2 3 4

Search: Search took 0.06 seconds.

  1. Replies
    16
    Views
    18,406

    That looks like it should work. What does...

    That looks like it should work.

    What does read_file return? There are several code paths that could result in it printing nothing. The two error exits from read_file, and the situation where num...
  2. Replies
    4
    Views
    2,028

    Or in fact, the GNU compiler manual, for inline...

    Or in fact, the GNU compiler manual, for inline assembly :)

    I guess you're trying to write a sequence of plain assembly instructions (i.e. unquoted, without asm()) in a C/C++ file.

    I don't...
  3. Replies
    10
    Views
    1,061

    Ah, never mind, I see you've got another thread...

    Ah, never mind, I see you've got another thread open about compiler errors. You really should post what the error messages are!
  4. Replies
    10
    Views
    1,061

    The obvious errors would be that you haven't...

    The obvious errors would be that you haven't defined sol[][] or solveMaze(). I didn't get anything else.

    That aside, this looks good. It solves the maze you've given, and removes markers from dead...
  5. The other popular way of handling this is to use...

    The other popular way of handling this is to use fgets to read the whole input line into a buffer. Provided the buffer is large enough, you'll get anything before and after the number, as well as the...
  6. Replies
    10
    Views
    1,061

    You say you got the wrong result -- I have no...

    You say you got the wrong result -- I have no idea how you managed to wrestle a compiler into compiling this! It's not that there are a lot of mistakes, just a couple that you really can't away with...
  7. I've decided it shouldn't be there, but I'll...

    I've decided it shouldn't be there, but I'll explain what I was thinking anyway:

    Initially my version of the program let you put whitespace in the expression, like "1 + 2 + 3". scanf would be a...
  8. Ahaa - I just saw your other thread. My previous...

    Ahaa - I just saw your other thread. My previous reply was really just about getting this code working, and won't help with operator precedence at all.

    It might help a bit with tokenisation...
  9. Ok. Since you're learning, I've kept it pretty...

    Ok. Since you're learning, I've kept it pretty similar to your code, so it doesn't throw a bunch of new concepts in. The resulting code is pretty fragile (will not work if you, for example, input a...
  10. I keep looking at that equation and trying to...

    I keep looking at that equation and trying to figure out how to use it to travel back in time.

    Anyway, yes, that's right. Just plug in the numbers to solve for time. I think it means the total...
  11. Good advice from Matticus. You're on the right...

    Good advice from Matticus.

    You're on the right track -- quite a few bugs and stuff to work out but it's the right idea.

    On the subject of splitting strings.... I don't think that's the right...
  12. while (inch

    while (inch<=MAX);


    Look. Look closely.... :) There's a semicolon there when there shouldn't be. This means:



    while (inch<=MAX)
    ; // do nothing
    <some more code that won't get...
  13. Replies
    9
    Views
    9,952

    With "r+" the file is required to exist before...

    With "r+" the file is required to exist before fopen is called -- is that what you want? "a+" will create it if it doesn't exist already, but won't clear an existing file.

    I prefer not to keep...
  14. Replies
    2
    Views
    1,147

    ssize_t is signed, so the loop will correctly not...

    ssize_t is signed, so the loop will correctly not run if size=1.

    On the code....
    You seem to be missing a parameter for size in your write() function, but other than that it seems to work.

    ...
  15. Replies
    4
    Views
    757

    +1 for stepping through it in a debugger. Always...

    +1 for stepping through it in a debugger. Always helpful.

    I'm guessing that it's the recursion in compute_val that is causing confusion. Note that get_val isn't called at all until compute_val has...
  16. Oh dear :(. No, not exactly ok or sober. It's a...

    Oh dear :(. No, not exactly ok or sober. It's a long story, but I have a few broken ribs and am so doped up I can barely see the keyboard.

    My apologies - had I realised that this had been noticed...
  17. Oh no! I'm really sorry, that was just a typo!! I...

    Oh no! I'm really sorry, that was just a typo!! I meant:



    fprintf(out,"%lf %lf %lf",cam->view_point.x,cam->view_point.y,cam->view_point.z);


    Sorry about that. I was staring and staring at...
  18. Yrah, you're right, I retract my advice about...

    Yrah, you're right, I retract my advice about using %f. It'll work, but as a rule I try to avoid sneaky implicit casts. Control freak.....

    I read a while ago that %f was float and for double, and...
  19. Um. Ok. I don't know where to start. Ok. ...

    Um. Ok. I don't know where to start.
    Ok.

    Your structuires are indeed structures, and I have nothing bad to say about them,

    However (I really do try to be nice) that fscan call is an...
  20. By vector, do you mean array, or some other sort...

    By vector, do you mean array, or some other sort of structure? I would not like to see what scanf() would do to a c++ vector. Probably give it its best shot and blow up your program.
  21. Replies
    1
    Views
    1,226

    Yeh, you have some truncaiton-to-integer issues...

    Yeh, you have some truncaiton-to-integer issues here:


    int temp;
    for (int e = 0; e < SIZE-1; e++)
    {
    for (int j = e+1; j < SIZE; j++)
    {
    if (arr2[e]...
  22. Heh - a few years ago I heard on the grapevine...

    Heh - a few years ago I heard on the grapevine that Microsoft had finally bracked and decided to support C11 (I don't mean C++11). Ot was the most reliable friend so I went on the net and found pages...
  23. Replies
    8
    Views
    937

    Ok -- what I was getting at, is that there's...

    Ok -- what I was getting at, is that there's going to be more than one unction that needs access to the array. Unless you plan to populate the array in display() too. Nasty!

    So you need to...
  24. No, no difference at all when tested on MSVC...

    No, no difference at all when tested on MSVC compiler at max optimisation.

    Here's the disassembly of your first snippet:


    char* test1(void) {
    push ebp
    mov ebp,esp
    sub ...
  25. Replies
    3
    Views
    1,171

    Interesting topic!! I'd never heard of...

    Interesting topic!!

    I'd never heard of "simulated annealing" before today. So I'm not really qualified to give you advice there.....

    Programming-wise:

    1. You're using integer literals...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4