Hi,

I have about 15 minutes of C++ experience, so excuse my ignorance.

I have a VB program that needs to output a text string followed by just a line feed and a NULL character. The Print command places a carriage return, line feed and NULL. I was hoping that maybe C++ could help.

In C++, when I try using "\n", the binary codes at the end of the file are 13 10 0. As far as I can tell that is a carriage return, line feed, and a NULL.

I need to have just a line feed and a NULL in order for another program to recognize the end of the text string. I can get a 13 0 at the end using "\r", but that does not work.

My code is:
Code:
#include <string>
#include <fstream>
#include <iostream>
using namespace std;

string in_file;
string out_file;

int main(in_file, out_file) {
	ofstream outfile( out_file );
	ifstream infile( in_file );

		if ( ! infile) {
			cerr << "error: unable to open input file!\n";
			return -1;
		}

		if ( ! outfile ) {
			cerr << "error: unable to open output file!\n";
			return -2;
		}

		string word;
		while( infile >> word)
			outfile << word << "\r";
	return 0;
}
I have tried every combination of codes I can think of. Is there something else I can try? I have tried outputting "\012" but this places 13 10 0 at the end, just like the Print command in VB is doing.

Thanks for any suggestions !