#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    1
    Rep Power
    0

    Thumbs up How to write a byte form input to output files?


    I am trying to write a tester for a function that takes writes stuff :flame:
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,363
    Rep Power
    1870
    > How would I write a tester for something like this?
    I guess you start with int main ( )

    Seriously, if you can't write a main to test this, how are you going to write a main to do the larger task of whatever it is you're trying to do?

    Create a simple test file with something like "ABC123", which you know what it looks like at the binary level.

    Open a stream, initialise your class, call it in a loop and print the bits.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo