ホーム » 2022 » 11月 » 21

日別アーカイブ: 2022/11/21

2022年11月
 12345
6789101112
13141516171819
20212223242526
27282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,198 アクセス



「.NET なんとか」

「.NET なんとか」のメモ.
.NET Framework
.NET (.NET Core)
.NET MAUI
.NET CLI


VS などが入っている環境だと,次のコマンドで SDK バージョンを確認できる.
dotnet –list-sdks
dotnet --info


Visual C++ で基本的なファイル I/O を実行する
C++/CLI プロジェクトを .NET Core または .NET 5 に移植する方法


C++/CLI
C++/CX
C++/WinRT


C++/CLI
「プロジェクト テンプレート」で「CLR 空のプロジェクト(.NET Framework)」を選択.
CLR .NET Framework
次の様な内容のソースを追加.

//#include "pch.h"

using namespace System;

int main(array<System::String^>^ args)
{
    Console::Write("test");
    return 0;
    }

VC 2022  CLR  プロパティ


次の所のコードと std::cin との混在.
ファイル処理と I/O (C++/CLI)

// file_info.cpp
// compile with: /clr

using namespace System;
using namespace System::IO;

#include	"ask_cli.hxx"

#include	"str_CLI.hxx"

bool	Draw_FileInfo	(c_tstring& file_name)
{
	String^		file = ::to_gcString(file_name) ;

	FileInfo^ fi = gcnew FileInfo(file) ;

	Console::WriteLine("file size: {0}", fi->Length);

	Console::Write    ("File creation date:  ");
	Console::Write    (        fi->CreationTime.Month.ToString());
	Console::Write    (".{0}", fi->CreationTime.Day.ToString());
	Console::WriteLine(".{0}", fi->CreationTime.Year.ToString());

	Console::Write    ("Last access date:  ");
	Console::Write    (        fi->LastAccessTime.Month.ToString());
	Console::Write    (".{0}", fi->LastAccessTime.Day.ToString());
	Console::WriteLine(".{0}", fi->LastAccessTime.Year.ToString());

	return	true ;
	}

int main()
{
	array<String^>^ args = Environment::GetCommandLineArgs();
	if (args->Length > 1) {
		tstring	file_name = ::to_tstring(args[1]) ;
		::Draw_FileInfo(file_name) ;
		}
	else {
		while(true)	{
			tstring	path = ::ask_cli(_T("file ... ? =")) ;
			if (path.empty())	{	break ;		}
			::Draw_FileInfo(path) ;
			}
		}
	return 0;
	}
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.