Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Bregma

Member Since 09 Dec 2005
Offline Last Active Jun 28 2015 04:41 AM

Posts I've Made

In Topic: Virtual base classes vs templates for multi-platform

19 June 2015 - 04:43 AM

Isolate you platform-specific code.  Put each platform implementation in separate .cpp files (with common .h files).  Build only those .cpp files for your target platform.

 

See, if you've designed your interface correctly, only the implementtaion changes behind the scenes.  1960s-era technology for the win.


In Topic: I like Mondays, and yet I hate weekends.

16 June 2015 - 09:01 AM

I usually work on weekends, too.  Mondays, however, is when I have to start interacting with people again, so sometimes it gets stressful.


In Topic: ofstream buffer size

14 June 2015 - 06:54 AM

If you're trying to write a text file, use the streaming format operators (operator<<()) to format output to the stream.  You will probably also want to stream some delimiters.

 

If you're trying to write a 'binary' file, you're going to want to write out the length of the data first, otherwise you'll have trouble reading it in.  The length of a zero-terminated C string is founf using std::strlen(), and the length of a C++ string is found using std::string::length().

 

I would suggest this sort of question is best asked in the For Beginners forum.


In Topic: compare ifstream to string

14 June 2015 - 06:49 AM

(1) Are you actually seeing the control flow reach the "if" statement comparing the strings?

(2) Are the strings actually identical, byte for byte?  Absolutely?  No whitespace differences?  Are the lengths identical?


In Topic: Could 'Borgs' Exist In The Near Future ?

11 June 2015 - 04:33 AM

They are among us even as we speak.


PARTNERS