Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OoMMMoO

file i/o stuff

This topic is 6930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way you can read from certain lines in a text file? I know how to read from the top down a certain amount of lines but what if you want to read from the center down? Also another question which isnt about file i/o are most sidescrollers tile based games? or are there some games were it is just a bitmap that is bigger than the screen?

Share this post


Link to post
Share on other sites
Advertisement
>> Is there a way you can read from certain lines in a text file? I know how to read from the top down a certain amount of lines but what if you want to read from the center down?

If I understand your question correctly, you want to calculate the "center" of a file? You can do that like so (old skool C file pointers ):

FILE *fp;
long f_length, f_center;
fp = fopen("yourfile.bin", "rb");

// Go to end of file
fseek(fp, 0, SEEK_END);

// Get length of file
f_length = ftell(fp);

// Calculate center of file
f_center = f_length / 2;

// Go to the center of the file
fseek(fp, f_center, SEEK_SET);

// Read stuff from center of file
fread(...)

>> are most sidescrollers tile based games? or are there some games were it is just a bitmap that is bigger than the screen?

Yep, most sidescrollsers are tilebased.

/. Muzzafarath

Edited by - Muzzafarath on 5/5/00 1:41:34 PM

Share this post


Link to post
Share on other sites
Can you imagine the size of the bitmap that would be required for the average level in Super Mario? I would be enormous! Probably 50 screens long and 3 high.

Make you game run in 16 bit color, 800x600, and you''re looking at allocating over 137 MEGABYTES of memory.

That''s one BIG DAMN video card! Where can I buy one?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!