问题:在用fwrite向文件中写数据时,当写入0x0A时,其前面总会被加上一个0x0D。
原因:出现这个问题的原因是fwrite 在以文本方式写文件时,碰到0x0A,会自动在前面加上0x0D,以够成回车换行符。
解决方案:以二进制方式打开文件,然后进行写文件。如下:
将问题的代码:
fopen( filename, "w+" );
改为下面代码:
正确代码:
fopen( filename, "wb+" );
上一篇文章中说了下CRT 不仅可以用来登陆开发板中个的linux,还可以用来登陆 虚拟机中的linux。
现在详细介绍下具体的操作:
1,ubuntu中默认的情况下时没有ssh的,在终端中:ssh localhost ,提示resufed,说明你还没装。在/etc/init.d下也找不到ssh文件。
安装:apt-get install openssh-server openssh-client
这是在/etc/init.d/下就可以找到ssh了,restart下,如图:
这样ubuntu中的配置就OK
到这里要提一句:首先保证ubuntu可以与windows ping通。
2,在CRT中快速链接,配置说明:SSH2为SSH服务的第二种链接方式;主机名就是你的ubuntu ip;用户名是你在ubuntu中的名;如下图
点击链接,过几秒钟后会出现下图,输入你的密码即可:
-------------------------------------------------------------------------------------------------------------------------------------
这样就可以OK了:
症状:
1. 运行下面的VBScript脚本,删除某个目录下的所有文件夹:
Set fso = CreateObject("Scripting.FileSystemObject") Set deleteDir = fso.GetFolder("D:\FTP_Folder\vbScriptTest") 'Set the directory you want to delete Set subFolders = deleteDir.Subfolders 'Get all the folders in the above directory Set toBeDeletedFoldersPath = CreateObject( "System.Collections.ArrayList" ) 'Store the paths of the folders that need to be deleted For Each folder in subFolders toBeDeletedFoldersPath.Add folder.path Next For Each folderPath in toBeDeletedFoldersPath fso.deleteFolder folderPath Next
对于某些文件目录能够删除成功,但是对于某些目录却得到如下的运行时错误:
解决方法:
1. 像下面这样在第11行代码末尾加一个参数True,表示强制删除只读文件夹:
Set fso = CreateObject("Scripting.FileSystemObject") Set deleteDir = fso.GetFolder("D:\FTP_Folder\vbScriptTest") 'Set the directory you want to delete Set subFolders = deleteDir.Subfolders 'Get all the folders in the above directory Set toBeDeletedFoldersPath = CreateObject( "System.Collections.ArrayList" ) 'Store the paths of the folders that need to be deleted For Each folder in subFolders toBeDeletedFoldersPath.Add folder.path Next For Each folderPath in toBeDeletedFoldersPath fso.deleteFolder folderPath, True 'force the deletion of read-only files Next