ホーム » 2013

年別アーカイブ: 2013

2024年4月
 123456
78910111213
14151617181920
21222324252627
282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,457 アクセス



String_Split

    MB MFC MB STL WC MFC WC STL
99103040 5714 0 20 0 70
99103036 14192 10 130 10 380
99103032 27636 10 400 20 1400
99103051 41128 20 900 20 3200
99103026 65388 50 2400 50 7200

単位は m sec

表では MFC と表現しているが,実際は CStringArray を利用している程度.
ちょっと意外だったのが,STL のコードで,UNICODE 版が MBCS 版の 3 倍以上になってしまっている.


STL を利用しているコードは以下の通り.
std::vector<tstring> String_Split (const tstring& str_,LPCTSTR sp=_T(" \r\n"))
{
  std::vector<tstring> strAry ;
  tstring str = str_ ;
  {
    tstring::size_type spPos = tstring::npos ;
    while ((spPos=::String_FindFirstOf(str,sp)) != tstring::npos) {
      if (str.empty()) { break ; }
      TCHAR fc = str[0] ;
      if (fc == _T(‘\"’) || fc == _T(‘\”)) { // "—" or ‘—‘
        if ((spPos=::String__Find(str,fc,1)) == tstring::npos) {
          break ;
          }
        if ((spPos = ::String_FindFirstOf(str,sp,spPos)) == tstring::npos) {
          break ;
          }
        }
      tstring splitS = str.substr(0,spPos) ;
      strAry.push_back(splitS) ;
      str = str.substr(spPos+1) ;
      if (str.empty()) { break ; }
      }
    if (!str.empty()) {
      strAry.push_back(str) ;
      }
    }
  return strAry ;
  }


String_Join も同様だが,MFC 版 StringArrayToLine1 の 1 割程度なので,このままとする.
MFC 版 StringArrayToString は十分速い.


StrAryFn.hxx

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

3DS

3DS 出力で正しくないのが生成されたので,バイナリを解析した時のメモ


http://www.dcs.ed.ac.uk/home/mxr/gfx/3d/3DS.spec
http://www.martinreddy.net/gfx/3d/3DS.spec

Chunk ID 2  
データ長 4 この次のデータの長さ + 6
データ    

 
4D4D
  3D3D
    AFFF
      A000        名称
      A020   15
        0011  9    RGB
    AFFF 
    …
    4000          名称
      4100    
        4110      頂点情報 ( WORD 頂点数 , [ float x , y , z ] )
        4140      テクスチャ ( WORD 点数 , [ float x , y ] )
        4160      
        4120      面情報 ( WORD 面数 , [ WORD 3 頂点のインデックス , WORD 面の情報 ] )
          4130    材質名 , WORD 面数 , [ WORD 面のインデックス ]
          4130        
          …
    B000      
      …


頂点数が WORD を超えていたのが原因.
PgonsA_To3DS の objIs1==TRUE で,vp3Ary.GetCount() >= 0x10000 の時,PgonsA_To3DS (…,FALSE,…) .

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ダイアログでのEyeChange

CStatic 内に表示するには,this ではなく &m_Image とする.
// u_Zoom. Init(this,&u_Scale) ;
   u_Zoom. Init(&m_Image,&u_Scale) ;
// u_EyeChg. Init(&m_Image) ;
   u_EyeChg. Init(this) ;
   Eye eye(Eye::StdR) ;
   u_EyeChg. SetEye (eye) ;
   u_EyeChg. SetExtent(doc->PartsA_.GetExtent()) ;
   u_EyeChg. Set_MouseEyeChange(TRUE) ;
// u_Zoom. Init(this,&u_Scale,&u_EyeChg) ;
   u_Zoom. Init(&m_Image,&u_Scale,&u_EyeChg) ;
MButton , MouseWheel では,InvalidateRect などが必要.
 void CAboutDlg::OnMButtonDown(UINT nFlags, CPoint point)
 {
   if (u_EyeChg. Event(GetCurrentMessage())) { return ; }
   if (u_Zoom. Event(GetCurrentMessage())) { InvalidateRect(NULL) ; return ; }
   CDialog::OnMButtonDown(nFlags, point);
  }
 BOOL CAboutDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
   if (u_EyeChg. Event(GetCurrentMessage())) { return TRUE ; }
   if (u_Zoom. Event(GetCurrentMessage())) { InvalidateRect(NULL) ; return TRUE ; }
   return CDialog::OnMouseWheel(nFlags, zDelta, pt);
  }

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Win XP 100%

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

.NET と Win32 API

HDC の利用
IntPtr のまま与えてしまうと,
  c:\…\Form1.h(156) : error C2664: ‘DrawText’ : 1 番目の引数を ‘System::IntPtr’ から ‘HDC’ に変換できません。


  IntPtr pDC = e->Graphics->GetHdc() ;
  HDC hDC = static_cast(pDC.ToPointer()) ;
// DrawText(hDC, tstr.c_str(), -1, &rect, 0 );
  e->Graphics->ReleaseHdc(pDC) ;
ちょっと古いが,プログラミング Visual C++.NET Vol.2 P.459


コードを修正しビルドすると,
  ~.obj : error LNK2028: 未解決のトークン (0A00005B) …
  ~.obj : error LNK2019: 未解決の外部シンボル …
error LNK2028 LNK2019
「親または…」にチェックを入れる.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

C# のコードを C++.NET で…

MSDN にあるサンプルを VC++2008 でビルドする.
MSDN 四角形内にテキストを折り返して描画する


新規プロジェクトで「Windows フォーム アプリケーション」.
「新規プロジェクト」-「Windows フォーム アプリケーション」
Paint のハンドラを追加.
Paint ハンドラの追加


private: System::Void Form1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) {
/*
  string text2 = “Draw text in a rectangle by passing a RectF to the DrawString method.”;
  using (Font font2 = new Font(“Arial”, 12, FontStyle.Bold, GraphicsUnit.Point))
  {
    Rectangle rect2 = new Rectangle(30, 10, 100, 122);
    // Specify the text is wrapped.
    TextFormatFlags flags = TextFormatFlags.WordBreak;
    TextRenderer.DrawText(e.Graphics, text2, font2, rect2, Color.Blue, flags);
    e.Graphics.DrawRectangle(Pens.Black, Rectangle.Round(rect2));
  }
*/

  String^        text2 = “Draw text in a rectangle by passing a RectF to the DrawString method.”;
  Drawing::Font^     font2 = gcnew    Drawing::Font(“Arial”, 12, FontStyle::Bold, GraphicsUnit::Point) ;
  Drawing::Rectangle^    rect2 = gcnew    Drawing::Rectangle(30,10,100,122) ;
  TextFormatFlags        flags = TextFormatFlags::WordBreak ;
  TextRenderer::DrawText(e->Graphics,text2,font2,*rect2,Color::Blue,flags) ;
  e->Graphics->DrawRectangle(Pens::Black,*rect2) ;
}


RECT または CRect にあたるものは,Drawing::Rectangle .
ここで利用している Font は Drawing::Font としないとエラーになる.
  c:\…\drawt_2\Form1.h(87) : error C2061: 構文エラー : 識別子 ‘Font’
DrawText などの Rectangle はハンドルではなく実体.


2013/11/05
C# の文字列の前の ‘@’
リテラル文字列


MFC での文字列の変数に対する += .
  CString str ;
  str += _T(“123”) ;
C++/CLI で System::String は可能であるが,C# の string ではエラーとなるみたい.


2013/11/06
C# で g.Dispose() ;
  C++ では delete g ;
Graphics.Dispose メソッド

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

WR9500N 追加

PA-WR9500N-HP/E を購入.
8500 が動作したまま接続.IP アドレスがぶつかることは認識していたがそれなりに動作していた.
8500 を 212 に変更.
一部の機器を除いて PC 関係はほぼこれで問題なさそう.
子機の設置は後日.


Mac での,Wi-Fi の状態の確認.「option」+「Wi-Fi マーク」
mac Wi-Fi


2013/10/31 追記
子機を設置.接続したのは今の所 TV のみ.
子機の状態をブラウザで見ると,リンクアップ速度 216Mbps となっている.
今回の LAN 環境とは関係ないことではあるが,以前 Win7 のホストとその中のゲストでのファイル共有が遅かった.
ゲストの WinXP からホストのファイルへのアクセスが特に遅かったが,いつの間にか改善したみたい.


最近稼動している全 PC の設定が終わったので,8500 を外した.
残りはプリンタぐらい?


2013/12/29
DBR-T460 を追加.子機に接続.
ネットワーク上の別の TV から,レコーダーにとりためたものが見れる様になった.


2014/02/07 追記
いつだったか忘れた,うちの環境ではあまり関係ないが,
初代 PS3 (CECHB00)をいろいろいじっていると,T460 が見えた.
PS3 メディアサーバー接続
また,先日録画した BTTF を BD-RE に焼いて,PS3 で再生.
これらのことは,さすがと感じる.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Mavericks インストール

OS X Mavericks をインストール.
ダウンロード,再起動後のインストール時間は 44 分?の表示だったが,...
  途中で見ると,2 時間 14 分とか,1 時間 36 分とか,...
  1 分未満の表示になってから,しばらく変化がなかった.5 分位?
前回の Mountain Lion と同様 1 時間程度.
さらに再起動後 15 分程度.


VirtualBox を起動すると,
  仮想マシン”WinXP-Dev”のセッションを開けませんでした。
  Failed to open/create the internal network ‘HostInterfaceNetworking-en1’
   (VERR_SUPDRV_COMPONENT_NOT_FOUND).
  終了コード : NS_ERROR_FAILURE (0x80004005)
  コンポーネント: Console
  インターフェース: IConsole {db7ab4ca-2a3f-4183-9243-c1208da92392}
Mavericks と VirtualBox で検索すると,
  VirtualBox を再インストールすれば良いとのこと.
ダウンロードフォルダにあった,VirtualBox-4.2.18-88780-OSX.dmp のインストールでうまくいった.


vdi をコピーしたいと思い,調べると VBoxManage clonehd が見つかった.
が,ちょっと面倒なのでさらに調べると,Virtual Box マネージャーにクローンがあった.
使ってみると,MAC アドレスがぶつかってしまってる.
ネットワークの設定で「高度」の中に,更新する機能があった.


2013/10/28 追記
OS のアップデート,AP の変更などいろいろあり,どれが原因か突き止められてないが,
ゲストと他の PC との接続などが安定してない.ホストとの接続もできない状態にもなった.
前回と同様に VirtualBox を再インストールすると意図した動作(他の PC が見える)にはなる.
それと,ちょっと別の困った現象.
マウス(Magic Mouse)の動作が安定しない?
ドロップダウンリストなどの時に意図しないものに切替ってしまう.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

LAN-RPT01BK 追加

LAN-RPT01BK を追加.
設置場所が悪いのか,ちょっと不安定な気がする.
スマートフォンなので詳細がわからないが,どうも途切れることがある様な感じ.
導入前は場所によりつながらなかったので,それよりは良くなったと思われる.


その後,ノート PC での速度が遅くなったみたいで,結局外す事にした.
また,アクセスポイントの位置を 1m 程度ずらすことにより,いい感じにカバーできるようになった.


LAN-RPT01BK

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

typedef … BOOL ;

iOS のプロジェクトでビルドすると,BOOL の定義(typedef int BOOL ;)で,
  /…/i_Define.hxx:30:18: Typedef redefinition with different types (‘int’ vs ‘signed char’)
iPhoneSimulator6.1/usr/include/objc/objc.h に以下が定義されている.
  typedef signed char BOOL;


以下の様に OBJC_BOOL_DEFINED で振り分け.
  #ifdef OBJC_BOOL_DEFINED
  #else
    typedef int BOOL ;
  #endif


i_define.hxx


他にも,Mac 64-bit でビルドすると,long のビット長の問題で幾つかワーニングになる.
いい対応方法が思いつかないので,ひとまず幾つかはそのままとする.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

C2061

既存のプロジェクトで,::To_tstring(const P2&…) を追加したら,
——————–構成: BLCombi – Win32 Debug——————–
コンパイル中…
ComPrj01.cpp
c:\…\vc98\include\memory(16) : error C2061: 構文エラー : 識別子 ‘THIS_FILE’ がシンタックスエラーを起こしました。
c:\…\vc98\include\memory(17) : error C2091: 関数は関数を返せません。
c:\…\vc98\include\memory(17) : error C2809: ‘operator new’ に仮引数リストがありません。
c:\…\vc98\include\memory(20) : error C2954: テンプレートの定義はネストできません。
c:\…\…..\blocklsv.cpp(398) : error C2678: 二項演算子 ‘+’ : 型 ‘class std::basic_string …’ の
  左オペランドを扱う演算子は定義されていません。(または変換できません)(新しい動作; ヘルプを参照)
cl.exe の実行エラー
ComPrj01.obj – エラー 5、警告 0


本来の対応は別の所にありそうだが,ComPrj01.cpp の先頭に #include <memory> を追加した.
  #include “StdAfx.h”
  #include “ComPrj00.hpp”
  #include <memory>
  …

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

VC 6 で _UNICODE

VC 6 コンソール AP で,_UNICODE を付加してビルドすると
——————–構成: T_F_Stat – Win32 ReleaseU——————–
コンパイル中…
T_F_Stat.cpp
C:\…\VC98\INCLUDE\winnt.h(195) : error C2371: ‘LPTSTR’ : 再定義されています。異なる基本型です。
  C:\…\Develop\_.SRC\__CPR_\tstring.hxx(33) : ‘LPTSTR’ の宣言を確認してください。
C:\…\VC98\INCLUDE\winnt.h(196) : error C2371: ‘LPCTSTR’ : 再定義されています。異なる基本型です。
  C:\…\Develop\_.SRC\__CPR_\tstring.hxx(34) : ‘LPCTSTR’ の宣言を確認してください。
C:\…\Develop\_.SRC\__Mlt_\Get_Path.hxx(64) : error C2664: ‘GetCurrentDirectoryA’ :
  2 番目の引数を ‘unsigned short *’ から ‘char *’ に変換できません。 (新しい機能 ; ヘルプを参照)
  指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
C:\…\Develop\_.SRC\__Mlt_\Get_Path.hxx(91) : error C2664: ‘GetLongPathNameA’ :
  1 番目の引数を ‘const unsigned short *’ から ‘const char *’ に変換できません。 (新しい機能 ; ヘルプを参照)
  指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
C:\…\Develop\_.SRC\__Mlt_\Get_Path.hxx(114) : error C2664: ‘GetTempPathA’ :
  2 番目の引数を ‘unsigned short *’ から ‘char *’ に変換できません。 (新しい機能 ; ヘルプを参照)
  指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
C:\…\Develop\_.SRC\__Win\HelpWAPI.hxx(107) : error C2664: ‘GetModuleFileNameA’ :
  2 番目の引数を ‘unsigned short *’ から ‘char *’ に変換できません。 (新しい機能 ; ヘルプを参照)
  指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
C:\…\Develop\_.SRC\__Win\HelpWAPI.hxx(143) : error C2664: ‘GetComputerNameA’ :
  1 番目の引数を ‘unsigned short *’ から ‘char *’ に変換できません。 (新しい機能 ; ヘルプを参照)
  指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
C:\…\Develop\_.SRC\__Win\HelpWAPI.hxx(163) : error C2664: ‘GetUserNameA’ :
  1 番目の引数を ‘unsigned short *’ から ‘char *’ に変換できません。 (新しい機能 ; ヘルプを参照)
  指示された型は関連がありません; 変換には reinterpret_cast、 C スタイル キャストまたは関数スタイルのキャストが必要です。
cl.exe の実行エラー
T_F_Stat.exe – エラー 8、警告 0


tstring.h で LPxTSTR の定義は次の様にしていた.
#ifdef _MSC_VER
typedef TCHAR* LPTSTR ;
typedef const TCHAR* LPCTSTR ;
#else
typedef char* LPTSTR ;
typedef const char* LPCTSTR ;
#endif


対応方法がわからず,#include <Afx.h> を追加すると通る様にはなった.


_UNICODE だけでなく UNICODE も追加すると,Afx.h なしでも通る様になった.


2020/09 コンソール AP での define

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

fopen と sopen

_tfopen と _tsopen の mode の関係がわからなかったので,コードを抜粋
(VS8)\VC\crt\src\_open.c より
  /* First mode character must be ‘r’, ‘w’, or ‘a’. */
  switch (*mode) {
    case _T(‘r’):
      modeflag = _O_RDONLY;
      streamflag |= _IOREAD;
      break;
    case _T(‘w’):
      modeflag = _O_WRONLY | _O_CREAT | _O_TRUNC;
      streamflag |= _IOWRT;
      break;
    case _T(‘a’):
      modeflag = _O_WRONLY | _O_CREAT | _O_APPEND;
      streamflag |= _IOWRT;
      break;
    default:
      _VALIDATE_RETURN((“Invalid file open mode”,0), EINVAL, NULL);
    }


openfile.hxx
vchrfile.hxx

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

sh でエラー

sh を作成して実行すると,
  iwao@VB-Ubuntu:~/Documents$ sh mount_error.sh
  mount_error.sh: 1: mount_error.sh: sudo: not found
以前作成したものと比較したが,Ubuntu 上では見分けがつかなかった.
Windows 環境にコピーして,MIFES で開くとそれぞれで文字コードが異なる.
エラーになる sh をバイナリで開くと,EF BB BF が付加されていた.
どうも Ubuntu 上で利用したツールで,保存時に UTF-8 BOM 付としてしまったみたい.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Xcode でのデバッグ?

Xcode でのデバッグ
::To_tstring_rz で,str[index] = sp としていたため.
  sp はデフォルトでは _T(‘\0’) で,_T(‘ ‘) なども指定できるようにしている.
  対応としては,return する前に c_str() とすることにした.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ostrstream の利用でメモリリーク

次の様なコードでメモリリーク.freeze(false) がなかったのが原因.


tstring To_tstring (const double v,const int w=0,const int p=6,const long f=0) {
  tstring str ;
  std::ostrstream strBuf ;
  if (f != 0) {
    strBuf.flags(f) ;
    }
  {
    strBuf.width(w) ;
    strBuf.precision(p) ;
    }
  {
    strBuf << v ;
    strBuf << std::ends ;
    }
  {
    str = strBuf.str() ;
  // strBuf.rdbuf()->freeze(false) ;
    }
  return str ;
  }


Detected memory leaks!
Dumping objects ->
{385} normal block at 0x00038168, 512 bytes long.
Data: < 1.05 > 20 20 31 2E 30 35 00 CD CD CD CD CD CD CD CD CD
{363} normal block at 0x00037F20, 512 bytes long.
Data: <233.50 > 32 33 33 2E 35 30 00 CD CD CD CD CD CD CD CD CD
{339} normal block at 0x00037C70, 512 bytes long.
Data: < 967 > 20 20 20 39 36 37 00 CD CD CD CD CD CD CD CD CD
{315} normal block at 0x00037A28, 512 bytes long.
Data: < 875 > 20 20 20 38 37 35 00 CD CD CD CD CD CD CD CD CD
{291} normal block at 0x000377E0, 512 bytes long.
Data: < 997 > 20 20 20 39 39 37 00 CD CD CD CD CD CD CD CD CD
{269} normal block at 0x00037598, 512 bytes long.
Data: < 1.08 > 20 20 31 2E 30 38 00 CD CD CD CD CD CD CD CD CD
{245} normal block at 0x00037350, 512 bytes long.
Data: < 955 > 20 20 20 39 35 35 00 CD CD CD CD CD CD CD CD CD
{223} normal block at 0x00037108, 512 bytes long.
Data: < 1.15 > 20 20 31 2E 31 35 00 CD CD CD CD CD CD CD CD CD
{201} normal block at 0x00036EC0, 512 bytes long.
Data: < 1.02 > 20 20 31 2E 30 32 00 CD CD CD CD CD CD CD CD CD
{169} normal block at 0x000369B8, 512 bytes long.
Data: < 1.06 > 20 20 31 2E 30 36 00 CD CD CD CD CD CD CD CD CD
{143} normal block at 0x00036770, 512 bytes long.
Data: < 1003 > 20 20 31 30 30 33 00 CD CD CD CD CD CD CD CD CD
Object dump complete.
スレッド 0xDEC 終了、終了コード 0 (0x0)。
プログラム ‘C:\…\DmpFS\Debug\DmpFS.exe’ はコード 0 (0x0) で終了しました。


MSDN strstreambuf::freeze


2013/08/26
上のコードを Xcode でビルドすると,strBuf.flags(f) の所で
    /Volumes/…/t_string.hxx:47:10: No matching member function for call to ‘flags’
  利用する前に fmtflags 型にして利用する様に変更.
    std::ios_base::fmtflags f = std::ios_base::fmtflags(f_) ;


2013/08/28
_UNICODE に対応できなかったので,ostringstream を利用する様に変更.
  tstring To_tstring (const double v,const int w=0,const int p=6,const unsigned f_=std::ios::fixed) {
    tstring str ;
  #ifdef _UNICODE
    std::wostringstream strBuf ;
  #else
    std::ostringstream strBuf ;
  #endif
    std::ios_base::fmtflags f = std::ios_base::fmtflags(f_) ;
    if (f != 0) { strBuf.flags(f) ; }
    strBuf.width(w) ;
    strBuf.precision(p) ;
    strBuf << v ;
    str = strBuf.str() ;
    return str ;
    }

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

MFC 追加でメモリリーク

MFC を利用しないコードを VC 6 でテストしていて,
  コンソール AP として作成したスケルトンに,::oGetFileSize を追加.
  MFC を利用した,::GetFileSize と動作を比べるために,
    プロジェクトの設定を変更(共有 DLL で MFC を使用).
    main 関数が存在するソースに Afx.h などの include を追加.
  ビルドして実行すると,メモリリークが発生するようになった.
  main 関数内を全てコメントにしてもあまり変わらない.


MFC サポートありで,コンソール AP を作成.
  同様に oGetFileSize と GetFileSize を追加.
  ビルド,実行すると特に問題ない.
  StdAfx.h 内の Afx.h などを tmain のソース内に移動.
  リビルドすると,メモリリーク発生.
どうも,Afx.h より前の iostream などが関係している.
また,リビルドしないと現象が変わらない.


StdAfx.h に iostream の include を追加
  #define VC_EXTRALEAN
  #include <iostream>
  #include <afx.h>


Detected memory leaks!
Dumping objects ->
{51} normal block at 0x00032440, 33 bytes long.
 Data: < C              > 00 43 00 CD CD CD CD CD CD CD CD CD CD CD CD CD 
{50} normal block at 0x00034F68, 40 bytes long.
 Data: < |L             > 14 7C 4C 10 16 00 00 00 00 00 00 00 00 00 00 00 
Object dump complete.
スレッド 0x1218 終了、終了コード 0 (0x0)。
プログラム 'C:\...\T_Con2\Debug\T_Con2.exe' はコード 0 (0x0) で終了しました。

iostream のインクルードを afx.h より後にすることで対応.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

open で errno = 13

ファイルにより,open で errno に 13 EACCES Permission denied が設定される.
  bool Get_fstat (LPCTSTR name,struct stat* fs) {
    if (fs == NULL) { return false ; }
    int fh = _topen(name,O_RDONLY) ;
    if (fh < 0) { i_Dump(errno) ; }
    if (fh < 0) { return false ; }
    memset(fs,0,sizeof(struct stat)) ;
    int ret = fstat(fh,fs) ;
    _close(fh) ;
    return (ret == 0) ;
    }
__FILE__ などは期待した動作だが,c:\pagefile.sys でエラーとなった.


VC 6 では,~\VC98\CRT\SRC\OPEN.C で CreateFile を呼出している.
その時の値は,
fileaccess 0x80000000
fileattrib 0x00000080
filecreate 0x00000003
fileshare 0x00000003
osfh 0x0013fef0
+ path 0x000326d1 “c:\pagefile.sys”
+ &SecurityAttributes 0x0013fdbc

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

circle.svg の Load で…

circle.svg の Load で,
‘System.Xml.XmlException’ の初回例外が System.Xml.dll で発生しました。
‘System.Xml.XmlException’ のハンドルされていない例外が System.Xml.dll で発生しました。
追加情報: セキュリティ上の理由から、DTD はこの XML ドキュメントでは使用できません。
DTD 処理を有効にするには、XmlReaderSettings の ProhibitDtd プロパティを False に設定し、XmlReader.Create メソッドにその設定を渡してください。
circle.svg load
<?xml version=”1.0″ standalone=”no”? >
<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd” >
<svg width=”320pt” height=”224pt” viewBox=”0 0 100 70″ xmlns=”http://www.w3.org/2000/svg” >
<circle cx=”30″ cy=”25″ r=”20″ fill=”orange”/>
<circle cx=”50″ cy=”35″ r=”20″ stroke-width=”4″ stroke=”brown” fill=”coral”/>
<circle cx=”70″ cy=”45″ r=”20″ stroke-width=”4″ stroke=”chocolate” fill=”none”/>
</svg>


これは,MSXML.dll を利用した場合も正しく読み込めていない(Xml_Import で対応).
Xml_Fnc.hxx の Xml_Import を MFC を利用しない様に書き直した時にもう一度考える.
現状の XmlI_MS や Xml_CLI は,DTD などが付加された xml には対応していない(Xml_Import では可能).

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

C4793 , C4279

Win 32 コンソール AP で MFC サポートのプロジェクトを作成.
/clr を有効にして,以下のコードで,


// L_xml_K.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
#include "StdAfx.h"
#include "L_xml_K.h"
#include "Xml_CLI.hxx"
#include "XmlOut.hxx"
#include "Xml_MS_.hxx"
#undef GetTempPath
#using <System.dll>
 
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
 
// 唯一のアプリケーション オブジェクトです。
CWinApp theApp;
using namespace std;
 
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
  int nRetCode = 0;
  if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) {
    _tprintf(_T("致命的なエラー: MFC の初期化ができませんでした。\n"));
    nRetCode = 1;
    }
  else {
    System::String^ tmp = System::IO::Path::GetTempPath() ;
    System::String^ url = tmp + "211626.svg" ;
    tstring inXml = ::to_tstring(url) ;
    Xml_E xe_CLI = XmlI_CLI::Import(inXml.c_str()) ;
    Xml_E xe_MFC = XmlI_MS ::Import(inXml.c_str()) ;
    tstring outCLI = inXml + _T("_CLI.svg") ;
    tstring outMFC = inXml + _T("_MFC.svg") ;
    XmlOut::Export(xe_CLI,outCLI.c_str()) ;
    XmlOut::Export(xe_MFC,outMFC.c_str()) ;
    }
  return nRetCode;
  }

—— すべてのリビルド開始: プロジェクト: L_xml_K, 構成: Debug Win32 ——
プロジェクト ‘L_xml_K’、構成 ‘Debug|Win32’ の中間出力ファイルを削除しています。
コンパイルしています…
StdAfx.cpp
コンパイルしています…
L_xml_K.cpp
c:\…\CRT_MBWC.hxx(179) : warning C4793: ‘vararg’ : 関数 ‘BOOL StPrintF(LPTSTR,size_t,LPCTSTR,…)’ 用に
  ネイティブ コードの生成が発生します
  c:\…\CRT_MBWC.hxx(149) : ‘StPrintF’ の宣言を確認してください。
C:\…\Xml_MS_.hxx(14) : warning C4279: ‘value’: タイプ ライブラリ ‘msxml.dll’ の識別子はキーワードです。
  ’rename’ 修飾子を使用してください。
C:\…\Xml_MS_.hxx(14) : warning C4279: ‘value’: タイプ ライブラリ ‘msxml.dll’ の識別子はキーワードです。…
C:\…\Xml_MS_.hxx(14) : warning C4279: ‘value’: タイプ ライブラリ ‘msxml.dll’ の識別子はキーワードです。…
C:\…\Xml_MS_.hxx(14) : warning C4279: ‘value’: タイプ ライブラリ ‘msxml.dll’ の識別子はキーワードです。…
C:\…\Xml_MS_.hxx(14) : warning C4279: ‘value’: タイプ ライブラリ ‘msxml.dll’ の識別子はキーワードです。…
C:\…\Xml_MS_.hxx(14) : warning C4279: ‘value’: タイプ ライブラリ ‘msxml.dll’ の識別子はキーワードです。…
C:\…\Xml_MS_.hxx(14) : warning C4279: ‘value’: タイプ ライブラリ ‘msxml.dll’ の識別子はキーワードです。…
リソースをコンパイルしています…
リンクしています…
マニフェストを埋め込んでいます…
L_xml_K – エラー 0、警告 8
========== すべてリビルド: 1 正常終了、0 失敗、0 スキップ ==========


C4793 は,可変個引数リストの関数のため.
  コンパイラの警告 (レベル 1 および 3) C4793
C4279 は検索すると,
  having MSXML warnings
  Why warning C4279 happens?


C4279 は,今回のプロジェクトのみの問題となると思われる.
  MSXML.dll と,System.Xml.dll を同一プロジェクトでは利用しない様にするため.
  今回は,それぞれで読込み,単純に書き込む動作のデバッグのためにプロジェクトを作成した.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.