How can I get the real number?

  • Thread starter Thread starter Allen Maki
  • Start date Start date
A

Allen Maki

//Hi everybody,

//I need your help.
//If I run this program I will get an 'L'.
//But I want to get the real number (76).
//Can anybody tell me what to do?

#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
int _tmain()
{
FileStream* fs = new FileStream(S"bar.txt", FileMode::Create);
BinaryWriter* bw = new BinaryWriter(fs);
bw->Write(76);
return 0;
}
 
//Hi everybody,
//I need your help.
//If I run this program I will get an 'L'.
//But I want to get the real number (76).
//Can anybody tell me what to do?

#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
int _tmain()
{
FileStream* fs = new FileStream(S"bar.txt", FileMode::Create);
BinaryWriter* bw = new BinaryWriter(fs);
bw->Write(76);
return 0;
}

Hi,
'L' is the ASCII symbol with numeric code 76.
You see this behavior because you write a binary file.
If you want to write the number 76 as text, use the TextWriter class instead
of the BinaryWriter class.
 
Back
Top