前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
| 文字コード | BOM | 説明 |
|---|---|---|
| utf-16LE | FFFE | 先頭2バイトが BOM です |
| utf-16BE | FEFF | 先頭2バイトが BOM です |
| utf-8 | EFBBBF | 先頭3バイトが BOM です |
| utf-8(BOM無し) | BOM は格納されていません | |
| Shift_JIS | BOM は格納されていません | |
| EUC | BOM は格納されていません |
"TEXT DATA\r\n" |
"C:\DATA\TEST\WK.TXT" "C:\HTML\PUBLIC\Windows.html" |
"C:\\DATA\\TEST\\WK.TXT" |
"\"TEXT DATA\"" |
| 文字 | 16進数 |
|---|---|
| \ | 5C |
| ソ | 835C |
| 構 | 8D5C |
| 表 | 955C |
c:\TMP\ソース\テスト.TXT |


char msg[256];
|
#include <windows.h> // OutputDebugString
String^ str;
int v1 = 12;
int v2 = 345;
str = "v1:" + v1.ToString() + " v2:" + v2.ToString();
OutputDebugString(str->Data());
|
#include <string> // STL の String を使う
using namespace std;
wstring s;
s = L"12, 3.45, {67}, { ab }; XYZ\r\n";
OutputDebugString(s.data());
// Token を切り出す
wstring Word;
int Size, Col, wk;
Size = s.length() - 1;
for (Col = 0; Col<Size;)
{
wk = s.find_first_not_of(L" ,;{}", Col);
Debug(L"Left=", wk);
Col = wk;
wk = s.find_first_of(L" ,;}\r\n", Col);
Debug(L"Right=", wk);
if (wk == Col) break;
Word = Word.assign(s, Col, wk - Col);
OutputDebugString(Word.data());
OutputDebugString(L"\r\n");
Col = wk + 1;
}
|
string str = "2019/02/21";
string[] ymd;
ymd= str.Split(new char[] {'/', '-'});
for(int i=0; i<m_ymd.GetLength(0); i++)
{
Debug.WriteLine("i={0}、ymd[i]={1}", i,m_ymd[i]);
}
|
#include <windows.h>
int i, wk;
Platform::Array<int>^ ary = ref new Array<int>(5);
for (i = 0; i < 5; i++) ary[i] = i;
for (i = 0; i < 5; i++)
{ wk = ary[i];
OutputDebugString(wk.ToString()->Data());
}
|
#include <vector>
std::vector<int> v;
v.push_back(1);
v.push_back(23);
v.push_back(456);
|
using System.Collections;
ArrayList array;
array = new ArrayList();
for(i=0; i<10; i++) array.Add(i);
foreach(int DAT in array)
{
Debug.WriteLine("value={0} ", DAT);
}
|
MessageBox.Show("プログラムを終了します","Message Box");
|
Windows::UI::Popups::MessageDialog^ dlg =
ref new Windows::UI::Popups::MessageDialog("Test Message");
dlg->ShowAsync();
|
async private void Button_Click(object sender, RoutedEventArgs e)
{
Windows.UI.Popups.MessageDialog dlg =
new Windows.UI.Popups.MessageDialog("Hello World");
await dlg.ShowAsync();
}
|
#include <windows.h>
OutputDebugString(L"★Test Debug Message\n");
int num = 123;
OutputDebugString(num.ToString()->Data());
void Debug(Platform::String^ msg, int v)
{ Platform::String^ str = msg + v.ToString() + "\r\n";
OutputDebugString(str->Data());
}
|
using System.Diagnostics; //Debug.Write を使うとき
Debug.Write("\n*** Debug Message ***\n");
int num = 123;
Debug.WriteLine("NUM:" + num);
|
using Windows.UI.ViewManagement;
public MainPage()
{
public MainPage()
{
this.InitializeComponent();
var view = ApplicationView.GetForCurrentView();
view.Title = "現在の時刻:" + DateTime.Now.ToString();
}
}
|
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="TitleBar" BorderBrush="Black" Background="DarkBlue" BorderThickness="1">
<TextBlock x:Name="TitleName" Text="My Application" Foreground="White"
Style="{ThemeResource BodyTextBlockStyle}" />
</Border>
</Grid>
MainPage::MainPage()
{
Windows::ApplicationModel::Core::CoreApplication::GetCurrentView()->TitleBar->ExtendViewIntoTitleBar = true;
InitializeComponent();
Windows::Globalization::Calendar^ cal = ref new Windows::Globalization::Calendar();
auto longTime = ref new Windows::Globalization::DateTimeFormatting::DateTimeFormatter("longtime");
DateTime time = cal->GetDateTime();
TitleName->Text = longTime->Format(time);
}
|
![]()
Program Guid 古いページの Windows & DirectX のプログラムガイドです。