1

Is it possible for a console app to return a binary stream instead of text?

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{




    return 0;
}

How to convert this code so that it returns a stream?

1 Answer 1

1

You can setup binary mode in this way, for example.

   int result;
   // Set "stdout" to have binary mode:
   result = _setmode( _fileno( stdout ), _O_BINARY );
   if( result == -1 )
      perror( "can't set binary mode for stdout" );
   else
      printf( "stdout mode is binary now" );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.