• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

108 Neutral

About Yohomyth

  • Rank
  1. INI loader

    I'm at 99% completion of the beta version. I'll post it up here when it's done. It might not be for a few days at the most, because of holidays. I want all the input you can give me. I need to know what I can change to make it better. Right now the rules of the reader are a little strict, and it can only store ints, doubles, and strings, but later I'll probably add support for arrays, enums, and some other nifty stuff. EDIT: spelling
  2. INI loader

    GRRR! I'm changing some things about my INI loader. i'm adding IniGetIntVal, IniGetRealVal, and IniGetStrVal instead of just IniGetVal. [Edited by - Yohomyth on December 26, 2005 1:57:20 PM]
  3. doubles in C!!!!!!!!

    Quote:No, but your code does work exactly as I suggested and therefore it suffers the inaccuracy problem when trying to represent 0.05. If you want to fix this you need to know how many digits of precision you are printing so you can add/subtract the appropriate amount to force your printing routine to round correctly. The problem has already been solved.
  4. Writing software

    this might be kinda primitive, but you can just use word for storyline and excel for characters, planets, and etc.
  5. Is there a way to find the length of a string resource before loading it? I want to know the size before allocating memory to put the string on so I don't allocate too little or too much. If there is no real way then I'll just make some external string table file DLL.
  6. doubles in C!!!!!!!!

    Quote:I would have expected 0x3FC00000 Maybe. I know it had 3F in it for sure though.
  7. doubles in C!!!!!!!!

    1.I'm not using iostreams, or ftoa, or anything like that. 3.Sorry about that. I'm kinda obsessive about putting comments before every tiny section of code.
  8. doubles in C!!!!!!!!

    it just pushes 0x3FF40000 or something onto the stack. it doesn't change. the debugger displays it as 1.2499999999. my converter also makes it turn out the same way. str_t WrReaVal( real_t val, int_t dig ) { str_t ret; real_t test; real_t larg; int_t len; int_t c; int_t cur; int_t i; bool_t neg; // negative? if( val < 0 ) { neg = TRUE; val *= -1; } // not negative else neg = FALSE; // count left digits if( val > 0.0 ) { // find largest digit test = 1; while( test <= val ) test *= 10; test /= 10; larg = test; // get string length if( larg >= 1 ) len = Zeros( test ) + 3 + Larger( 1, dig ); else len = ( 3 + Larger( 1, dig ) ); } // negative? if( neg ) len++; // allocate string ret = MemAlloc( len ); c = 0; // negative? if( neg ) { ret[0] = '-'; c++; } // above while( larg >= 1 ) { ret[c] = '0' + ( cur = (int_t) val / (int_t) larg ); val -= (real_t) cur * larg; c++; larg /= 10; } // decimal ret[c] = '.'; c++; // zero right digits? if( dig == 0 ) { ret[c] = '0'; c++; } // right digits else { for( i = 0; i < dig; i++ ) { ret[c] = '0' + ( cur = (int_t)( val / larg ) ); val -= (real_t) cur * larg; c++; larg /= 10; } } // return ret[c] = 0; return ret; } val is a real_t (which is double in this case) and is the number that gets converted. this probably isn't the best converter, but i didn't have much time to make it. dig is the number of digits to the right of the decimal that will be displayed.
  9. doubles in C!!!!!!!!

    i'm not using printf
  10. doubles in C!!!!!!!!

    Quote:Or the conversion from binary to decimal for displaying the number is wrong (i.e. in your debugger or in printf) if this is true, then there may be something wrong with my code, but there may not be. after passing 1.25 through the function, the debugger says it's 1.2499999999. but i have a function that converts a double into a string to store it in an INI file, and it gets the same result as the debugger. but if this imperfection hasn't affected anything before, i don't see why it would after it's changed to a string and back.
  11. doubles in C!!!!!!!!

    i think Fruny is right. i've tried 1.25, 1.250, 1.25f, 1.250f, even 1.25d out of curiosity, but that caused a compiler error.
  12. whenever i pass 1.25 into a function as a parameter, it turns into 1.249999999! is there a way to prevent this?
  13. I drew a picture for you

    Its a spacemans sorry..i just can't get over that
  14. winxp problem!!

    for some reason, the 'open' command was deleted from folders, so i can only explore or search. i added a new 'open' that executes this command: C:\WINDOWS\EXPLORER.EXE /root,"%1" it helps for now, but folders always open in new windows, and some folders like 'my network places' won't open at all. what is the original command used to open folders?
  15. [solved] ReadConsole

    that helped a bit. i nulled szInput, but it just came out null, so apparently i'm putting something wrong into ReadConsole. i'll try to figure that out.
  • Advertisement