找回密码
 加入
搜索
查看: 1391|回复: 7

关于StringEncrypt

[复制链接]
发表于 2009-7-27 21:54:48 | 显示全部楼层 |阅读模式
本帖最后由 lsq726 于 2009-7-27 23:16 编辑

这样可以正确运行
#include <String.au3>
$aaa = _StringEncrypt(1, "aaa", "sw")
MsgBox(0, "", $aaa)
下面这个不能正确运行
#include <String.au3>
$file = FileOpen("aa.txt", 0)

; 检查打开的文件是否可为读
If $file = -1 Then
    MsgBox(0, "错误", "不能打开文件.")
    Exit
EndIf


While 1
    $chars = FileRead($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "读取的字符:", $chars)
Wend

FileClose($file)

$IbvCFG = _StringEncrypt(1, $chars, "sw")
MsgBox(0, "", $IbvCFG)
===========
6楼,,可能第二个写的有问题吧。。我也不知道,,,,6楼的代码可以正常
发表于 2009-7-27 22:02:02 | 显示全部楼层
声明一下变量$chars试试看
 楼主| 发表于 2009-7-27 22:07:59 | 显示全部楼层
本帖最后由 lsq726 于 2009-7-27 22:15 编辑

前面加

dim $chars ?


这样加了,,还是不行。。

=====

取到的 是空值
发表于 2009-7-27 22:26:21 | 显示全部楼层
本帖最后由 afan 于 2009-7-28 01:25 编辑

貌似 FileRead($file) 不需要循环... 空值的原因还可能和未以 ANSI 编码有关
 楼主| 发表于 2009-7-27 22:49:15 | 显示全部楼层
#AutoIt3Wrapper_UseAnsi=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <String.au3>

$aaa = _StringEncrypt(1, "aaa", "sw")

MsgBox(0, "", $aaa)
这样第一个就能正常运行了。。

第二个 加了也不行。
 楼主| 发表于 2009-7-27 22:53:20 | 显示全部楼层
#AutoIt3Wrapper_UseAnsi=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <String.au3>
$chars = FileRead("aa.txt")
$chars = _StringEncrypt(1, $chars, "sw")

MsgBox(0, "", $chars)
这样可以了。。我也不知道哪错了。
发表于 2009-7-28 00:54:50 | 显示全部楼层
#include <String.au3>
$file = FileOpen("aa.txt", 0)
While 1
    $chars = FileRead($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "读取的字符:", $chars)
Wend
    MsgBox(0, "读取的字符:", $chars)
测试以上代码就知道出错的原因了
发表于 2009-7-28 01:24:39 | 显示全部楼层
因为他加了循环,结果退出循环时正好也是读到空的时候,呵呵
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-2 13:57 , Processed in 0.073960 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表