Search:

Type: Posts; User: Hodor

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: HyperC

    by Hodor
    Replies
    79
    Views
    901

    In the function where you read the entire file...

    In the function where you read the entire file into a global array, you open a file (without checking that it was actually opened) and then proceed to read the file (using fgets into a 256 char...
  2. yes, it's a little bit clearer. Can you show us...

    yes, it's a little bit clearer. Can you show us the code you've written so far attempting to solve this problem?

    Edit: btw, to store a value in a value in an array is the same no matter how the...
  3. Can you provide a better explanation of what...

    Can you provide a better explanation of what you're trying to achieve?
  4. Replies
    5
    Views
    62

    Instead of hassling with Cygwin you may be better...

    Instead of hassling with Cygwin you may be better off using Windows subsystem for Linux (assuming you have Windows 10)

    Install Windows Subsystem for Linux (WSL) on Windows 10 | Microsoft Docs
  5. Replies
    33
    Views
    770

    Well, yes. Same difference except I used this...

    Well, yes. Same difference except I used this tree

    15838

    I started writing an explanation of how my snippet works but I a quick search finds similar implementations (e.g. Morse encoder –...
  6. Thread: HyperC

    by Hodor
    Replies
    79
    Views
    901

    What happens if the input file doesn't fit into a...

    What happens if the input file doesn't fit into a char array of size 1000000 and why read the entire file into memory?
    Also it would be nice to check that calls to fopen() succeed before reading...
  7. Replies
    33
    Views
    770

    My 2nd program doesn't actually do exactly that....

    My 2nd program doesn't actually do exactly that. Assuming that the input text should be "-- -.-- -. .- -- . .. ... ... . .- -."" and not what's given, my 2nd program decodes it as:



    $ echo...
  8. Replies
    33
    Views
    770

    Oh, I dunno. Sometimes gibberish is good. E.g. if...

    Oh, I dunno. Sometimes gibberish is good. E.g. if someone can be bothered understanding the code I wrote below -- i.e. how it works -- then maybe they'll learn something about data structures. Who...
  9. Thread: HyperC

    by Hodor
    Replies
    79
    Views
    901

    Ok, I want to use it

    Ok, I want to use it
  10. Thread: HyperC

    by Hodor
    Replies
    79
    Views
    901

    Why not open source it? It's not as if it's going...

    Why not open source it? It's not as if it's going to make you a millionaire... I guess not anyway
  11. Replies
    33
    Views
    770

    Yeah, it's a crazy thing to do I know

    Yeah, it's a crazy thing to do I know
  12. Replies
    33
    Views
    770

    Well, it's a pretty silly question for an exam....

    Well, it's a pretty silly question for an exam. Here's an attempt written in a way I'd never write it in real life. You really wouldn't write it this way in real life and I find it kind of a dumb...
  13. Replies
    33
    Views
    770

    Your compare function still has undefined...

    Your compare function still has undefined behaviour if the length of string1 is longer than string2's length (because would be reading/comparing beyond the end of string2). Try adding a break.

    For...
  14. Thread: HyperC

    by Hodor
    Replies
    79
    Views
    901

    Perhaps if it was open source then I'd give it a...

    Perhaps if it was open source then I'd give it a go. As for running a random .exe on one of my Windows computers... ?... yeah, no thanks ;) I guess I could see if it works in Linux using Wine, but...
  15. Thread: pre-compiler

    by Hodor
    Replies
    13
    Views
    171

    Ok, so you've updated it since post #7 but now...

    Ok, so you've updated it since post #7 but now it's inefficient.
  16. Thread: pre-compiler

    by Hodor
    Replies
    13
    Views
    171

    I expect the code in post #7 has the exact error...

    I expect the code in post #7 has the exact error being pointed out



    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    int compare(char *string1,char *string2) {
    int response = 1;...
  17. Replies
    25
    Views
    617

    Why would I want to forget about it? It's...

    Why would I want to forget about it? It's interesting if only because there are people out there insane enough to use floating point numbers for dealing with money :D
  18. Replies
    25
    Views
    617

    Well, the discussion wasn't about using or not...

    Well, the discussion wasn't about using or not using library calls so I'm not sure what you point is. Plus I don't think your method is going to work very well for amounts such as -0.33 because it'll...
  19. Replies
    25
    Views
    617

    For 0.999 in this scenario I would expect the...

    For 0.999 in this scenario I would expect the answer to be 0, 100 so that's not an oops. Even if you disagree, the point of my quick and dirty "test" program was not to handle every single edge case...
  20. Replies
    25
    Views
    617

    I don't really understand the issue here ...

    I don't really understand the issue here



    #include <stdio.h>
    #include <math.h>

    int main(void)
    {
    const double testvalues[] = {
  21. Replies
    4
    Views
    194

    Yes, round() is only executed in the loop.

    Yes, round() is only executed in the loop.
  22. Replies
    25
    Views
    617

    A potential third approach it to not even convert...

    A potential third approach it to not even convert to integer (or float, or anything other than characters) ever... until and unless a calculation is needed. If a calculation is not needed then just...
  23. Replies
    25
    Views
    730

    Or, better still (IMO) don't read the source...

    Or, better still (IMO) don't read the source character-by-character because that just makes things harder than they need to be
  24. Replies
    25
    Views
    730

    Hmm. Well, your answer in the other thread didn't...

    Hmm. Well, your answer in the other thread didn't answer my question. You have (in this example)



    int rdEscChr( int_c_voidp_t getchr, void *source, int c, char32_t *c32 )


    instead of the...
  25. Replies
    25
    Views
    730

    Is it safe assigning -1 to 'num' (or c32 for that...

    Is it safe assigning -1 to 'num' (or c32 for that matter) considering num is unsigned? Other than that I guess the function is perfect. Except, why is 'source' a void*?
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4