Hw2Examples - String^ fname = Console:ReadLine...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// characterOutput.cpp : main project file. #include "stdafx.h" #include <iostream> using namespace System; using namespace std; int main(array<System::String ^> ^args) { char a = 'a'; wchar_t c1, c2; c1 = static_cast <wchar_t> (a); c2 = a; Console::WriteLine(L"c1 = {0}, c2 = {1}", c1.ToString(), c2.ToString()); Console::WriteLine(L"c1 = {0}, c2 = {1}", c1, c2); return 0; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#include "stdafx.h" #include <fstream> #include <iostream> #include < stdlib.h > #include < vcclr.h > using namespace System; using namespace std; int main(array<System::String ^> ^args) { ifstream inpt; Console::WriteLine(L"Enter the input file name");
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: String^ fname = Console::ReadLine(); pin_ptr<const wchar_t> wch = PtrToStringChars(fname); size_t origsize = ((fname->Length + 1) * 2); // length in bytes const size_t newsize = 80; size_t convertedChars = 0; char inFile[newsize]; wcstombs_s(&convertedChars, inFile, origsize, wch, _TRUNCATE); inpt.open(inFile); // inpt.open("board.dat"); int board[80]; int size; inpt >> size; cout << size << endl; for (int j = 0; j < size; j++) {inpt >> board[j]; cout << board[j] << endl; } inpt.close(); return 0; }...
View Full Document

This note was uploaded on 04/08/2008 for the course EE 361 taught by Professor Conry during the Spring '08 term at Clarkson University .

Page1 / 2

Hw2Examples - String^ fname = Console:ReadLine...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online