Jump to content

  • Log In with Google      Sign In   
  • Create Account


iGoogleThis

Member Since 31 Aug 2007
Offline Last Active May 11 2014 05:48 PM

Posts I've Made

In Topic: First Paradise - Hybrid Interactive Fiction

11 May 2014 - 05:41 PM

You can now download both a Windows and Linux build here!


In Topic: Plucking strings from an array

12 December 2013 - 01:08 PM

hey GD,  I have some code I'm trying to get working.  The goal is to take one random string from 2 different arrays and print the result.  Based on the tests I've run I'm having trouble getting a string and not just a set of numbers or unknown characters for some odd reason.  Here is a modified (for clarity) example of what I have now.

void NameGen(WINDOW *win)
{
srand(time(NULL));

	int lstn = rand() % 5;
	int fstn = rand() % 5;


char *surname[5] = { "Carter", "Nagano", "Johnson", "Boustrup", "Smith"};
char *first_name[5] = {"Jeremy", "Chris", "Aya", "Corey", "Eiden"};

wprintw(win, "%s, %s", surname[lstn], first_name[fstn]); 

}

EDIT: Fixed, the above example is actually, infact, exactly how one would go about doing this.  By seeding and setting rand() to the same value as the array you essentially leave it up to the program to spit the results back out at you.  The above sample also works with single characters and numbers.  there is plenty of room for optimization, this function is barebones.  I suggest having something offset a recalculation if you plan on calling something like this more than once so that you don't generate different names every time (unless that's what you desire).


In Topic: Continue reading after set indicators? C FILE I/O

14 July 2013 - 05:11 PM

 

Well something like this should work:

bool useDataFromNowOn = false;

while(!feof(fp))
{
    int ch = fgetc(fp);

    if(useDataFromNowOn)
    {
        ... do something with ch
    }

    if(ch == '*')
    {
        useDataFromNowOn = true;
    }
}

 

You are mighty, thanks!


In Topic: Continue reading after set indicators? C FILE I/O

14 July 2013 - 02:33 PM

I don't really understand what the problem is. 

You can read byte by byte and check for the asterisk, and continue reading and storing data.
If you want faster performance, you could read the file in chunks or the entire file at once.

 

Perhap my understanding of the fgets function is abit slim however if you could elaborate or maybe give me an example that would be badass.  The problem is that I don't know how to check for an asterisk, safe to say I'm not used to doing elaborate file I/O routines.  I have ideas but a well explained solution would be much more helpful.


In Topic: I Want To Write Embedded Software etc

18 June 2013 - 04:06 PM


Embedded is a deep hole to swim in if you have no clue the direction you want to go but there are tons of people that can help you out.

 

Your post for example helped me put some things in perspective, thanks for the insight.  I want to get into ground up/OS development with a focus on OS development in the long run.  I will check out eevblog, thanks again!

 


Gameboy Advance is what really got me into embedded stuff. Might be a good "stepping stone" between regular PC game development, and direct fiddling with microprocessors and sensors and such. After you get used to working with memory mapped hardware registers, managing RAM by hand, writing ARM assembly and putting it in RAM instead of ROM so it runs faster, etc. you'll know how it is for programs to interact with hardware directly.

 

I'm working on doing a little something for the atari 2600 right now.  Do you think that's equally as good of a learning experience in comparison to the restraints of the game boy?

 

It seems as though I should look into AVR and PIC chips.  Really appreciating the help.


PARTNERS