turbo pascal/c 实现Dos下控制(HP等)打印机打印汉字的编程思路和代码?谢谢
解决方案 »
- win2000 和delphi6 的编译问题
- 这个树型算法怎么写?
- 高分求:实现QQ收到信息任务栏下头像一闪一闪及下线后变成灰色的解决方案
- 怎么用写程序控制TOMCAT启动和退出????
- indy与fastnet下的udp控件有何区别?性能有何不同?
- free释放的是哪个object?
- adoquery的fieldby问题
- Delphi CxGrid排序问题
- 我有三千多可用分,用不完,所以散点分来统计个问题,请长沙的程序员来捧捧场
- 请教:简单的Delphi向web服务器提交问题,初学,请指教!
- 請教: .DB查詢問題
- 请用delphi作 当鼠标指向某个地方,出现在解释框,鼠标移开了就没有了,请问各们大虾怎么关现啊
Rewrite(MyFile);
strTemp := '中国人';
writeln(MyFile, FormatPRNString(strTemp));
System.CloseFile(MyFile);
Function FormatPRNString(str:string):string;
//将要打印的字符串转换成相应打印格式,适应于:EPSON TM300系统列
//刚写的,看看吧
var
ch:char;
i:integer;
chinese:boolean;
begin
chinese:=false;
i:=1;
while i<=length(str) do
begin
ch:=str[i];
if ch>#127 then
if str[i+1]>#127 then //一个完整折汉字
begin
if not chinese then result:=result+#28+#38;
chinese:=true;
result:=result+ch+str[i+1];
inc(i);
end
else //半个汉字
begin
if chinese then result:=result+#28+#46;
chinese:=false;
result:=result+#32;
end
else //ASCII码
begin
if chinese then result:=result+#28+#46;
chinese:=false;
result:=result+ch;
end;
inc(i);
end;
end;