易截截图软件、单文件、免安装、纯绿色、仅160KB

Delphi字符串、PChar与字符数组之间的转换

Delphi字符串、PChar与字符数组之间的转换
设有以下三个变量:
var
s:string;
p:pchar;
a:array[1..20] of char;
那么三者之间的转换如下:
1、字符串到PChar
    p:=PChar(s);
2、PChar到字符串
    s:=p;
3、PChar到字符数组
    StrCopy(@a,p);
4、字符数组到PChar
    PChar(@a);
5、字符串与字符数组之间的转换就只有通过PChar来中转了。例如下面这个例子:
procedure TForm1.btn1Click(Sender: TObject);
var
str:array[1..10] of char;
begin
StrCopy(@str,PChar(mmo1.Text));
mmo2.Text:=PChar(@str);
end;


相关文档:

Delphi Excel to Sql Server

 unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB,comobj, OleServer,
  ExcelXP;
type
  TForm1 = class(TForm)
    ADOConn: TADOConnection;
& ......

Delphi文件操作

 unit unitFileOP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
implementation
function GetSys32Dir:String;
var
Sys32Dir: string;
pSys32Dir: array[0..Max_Path] of char;
begin
GetSystemDirectory(pSys32Dir,Max_Pat ......

Delphi 资源


 关于IntraWeb程序在编译时出现错误的解决方法
错误提示:[Error] IWLicenseKey.pas(12): Undeclared identifier: 'SetLicenseKey'
处理方法:进入菜单Tools->Environment Options,选择‘Library’,将'Library path'参数中有关intraweb的目录放在前面即可。
使用&n ......

delphi学习 字符串切割问题(split)

最近做一个项目,要用Delphi,以前从未学过,好是费劲啊,哈哈光是字符串切割这个问题就困扰了几个小时,通过查资料终于解决,在这与大家分享一下
Function split(src: pchar; ch: char):TStringList;
// 分割字符串
var
  i: Integer;
  tmp : string;
begin
  Result:=TStringList.Create;
  ......

Delphi中利用MSCOMM控件进行GPS数据采集

1、准备
  GPS(Global Positioning System),即全球定位系统,利用24颗GPS卫星的测距和测时功能进行全球定位,在许多系统中,如机场导航系统,出租车辆管理和调度系统、江河流域的灾害信息管理和预测系统中,GPS得到了广泛的应用。本文利用MSCOMM控件实现了GPS数据的采集,可为信息管理和指挥调度等提供定位数据。
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号