資源簡介
TDMS文件讀寫【官方C語言例程】,附件提供官方全部源文件下載及我自己寫的C#非托管調用代碼(只有讀tdms&tdm;文件的代碼,寫文件與之類似)。網上搜了好幾天都沒找到正經可以用的示例代碼,索性自己動手寫了。我的運行環境:VS2015、VS2019 + x64系統,里面官方DLL庫調用時需要選擇x86或x64版本,要和你的開發環境保持一致。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Runtime.InteropServices;
using?System.Text;
namespace?tdms
{
????class?Program
????{
????????static?void?Main(string[]?args)
????????{
????????????read(@“E:\1.tdms“);
????????????l(“按任意鍵退出“);
????????????Console.ReadKey(true);
????????}
????????//打開文件獲取句柄
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_OpenFileEx“)]
????????public?static?extern?int?DDC_OpenFileEx(string?filePath?string?fileType?int?readOnly?ref?IntPtr?flie);
????????//關閉文件
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_CloseFile“)]
????????public?static?extern?int?DDC_CloseFile(IntPtr?flie);
????????//獲取文件屬性值長度
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetFileStringPropertyLength“)]
????????public?static?extern?int?DDC_GetFileStringPropertyLength(IntPtr?flie?string?typeName?ref?int?length);
????????//獲取文件屬性值內容
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetFileProperty“)]
????????public?static?extern?int?DDC_GetFileProperty(IntPtr?flie?string?property?IntPtr?pAddr?int?length);
????????//獲取?Group?個數
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetNumChannelGroups“)]
????????public?static?extern?int?DDC_GetNumChannelGroups(IntPtr?flie?ref?int?groupsNum);
????????//獲取?Group?數組
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetChannelGroups“)]
????????public?static?extern?int?DDC_GetChannelGroups(IntPtr?flie?IntPtr?pAddr?int?groupsNum);
????????//獲取?group?屬性值長度
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetChannelGroupStringPropertyLength“)]
????????public?static?extern?int?DDC_GetChannelGroupStringPropertyLength(IntPtr?group?string?property?ref?int?length);
????????//獲取?group?屬性值內容
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetChannelGroupProperty“)]
????????public?static?extern?int?DDC_GetChannelGroupProperty(IntPtr?group?string?property?IntPtr?pAddr?int?length);
????????//獲取?channel?個數
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetNumChannels“)]
????????public?static?extern?int?DDC_GetNumChannels(IntPtr?group?ref?int?channelsNum);
????????//獲取?channel?數組
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetChannels“)]
????????public?static?extern?int?DDC_GetChannels(IntPtr?group?IntPtr?pAddr?int?channelsNum);
????????//獲取?channel?屬性值長度
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetChannelStringPropertyLength“)]
????????public?static?extern?int?DDC_GetChannelStringPropertyLength(IntPtr?channel?string?property?ref?int?length);
????????//獲取?channel?屬性值內容
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetChannelProperty“)]
????????public?static?extern?int?DDC_GetChannelProperty(IntPtr?channel?string?property?IntPtr?pAddr?int?length);
????????//獲取?channelValue?個數
????????[DllImport(“nilibddc.dll“?EntryPoint?=?“DDC_GetNumDataValues“)]
????????public?static?extern?int?DDC_GetNumDataValues(IntPtr?channel?ref?int?valuesNum);
????????//獲取?channelValue
??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\lib\64-bit\
?????文件????????4143??2017-10-12?02:07??TDM?C?DLL[官方源文件]\samples\writeFile.c
?????文件????????7338??2017-10-12?02:07??TDM?C?DLL[官方源文件]\samples\readFile.c
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\
?????文件????????4708??2017-10-12?02:07??TDM?C?DLL[官方源文件]\README.TXT
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\32-bit\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\32-bit\DataModels\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\32-bit\DataModels\USI\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\32-bit\DataModels\USI\1_0\
?????文件???????18725??2017-10-12?02:07??TDM?C?DLL[官方源文件]\dev\bin\32-bit\DataModels\USI\1_0\usi_1_0.xsd
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\32-bit\DataModels\USI\TDM\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\32-bit\DataModels\USI\TDM\1_0\
?????文件????????6032??2017-10-12?02:07??TDM?C?DLL[官方源文件]\dev\bin\32-bit\DataModels\USI\TDM\1_0\USI_TDM_1_0.xm
?????文件???????25966??2017-10-06?05:19??TDM?C?DLL[官方源文件]\dev\bin\32-bit\em
?????文件???????11560??2017-01-18?01:06??TDM?C?DLL[官方源文件]\dev\bin\32-bit\USI_Xerces_License.txt
?????文件?????????570??2017-01-18?01:06??TDM?C?DLL[官方源文件]\dev\bin\32-bit\USI_Xerces_Notice.txt
?????文件??????305664??2017-10-12?02:13??TDM?C?DLL[官方源文件]\dev\bin\32-bit\Uds.dll
?????文件?????2570240??2017-10-12?02:10??TDM?C?DLL[官方源文件]\dev\bin\32-bit\dacasr.dll
?????文件??????843264??2017-10-12?02:37??TDM?C?DLL[官方源文件]\dev\bin\32-bit\nilibddc.dll
?????文件??????792992??2017-03-10?01:06??TDM?C?DLL[官方源文件]\dev\bin\32-bit\tdms_ebd.dll
?????文件?????1022976??2017-10-12?02:14??TDM?C?DLL[官方源文件]\dev\bin\32-bit\usiEx.dll
?????文件??????735232??2017-10-12?02:12??TDM?C?DLL[官方源文件]\dev\bin\32-bit\usiPluginTDM.dll
?????文件?????1382400??2017-10-12?02:15??TDM?C?DLL[官方源文件]\dev\bin\32-bit\uspTdms.dll
?????文件?????1945088??2017-01-18?01:06??TDM?C?DLL[官方源文件]\dev\bin\32-bit\xerces-c_3_1_usi.dll
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\64-bit\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\64-bit\DataModels\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\64-bit\DataModels\USI\
?????目錄???????????0??2019-06-06?14:24??TDM?C?DLL[官方源文件]\dev\bin\64-bit\DataModels\USI\1_0\
?????文件???????18725??2017-10-12?02:07??TDM?C?DLL[官方源文件]\dev\bin\64-bit\DataModels\USI\1_0\usi_1_0.xsd
............此處省略71個文件信息
- 上一篇:USB 3.0編程寶典.pdf
- 下一篇:VC++下的語音識別源代碼
評論
共有 條評論