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

VS2005中,access对只读目录的属性判断不准确

只读目录,
C:\>attrib +A +S +H +R testdir
C:\>attrib testdir
A  SHR     C:\testdir
(1)VC6.0的执行结果:
***********test stat***********************
file [c:\testdir] exists!
file [c:\testdir] is directory!
file [c:\testdir] can be read!
file [c:\testdir] can not be writed!
***********test access***********************
file [c:\testdir] exists!
file [c:\testdir] can not be writed!
file [c:\testdir] can be read!
(2)VS2005的执行结果
***********test stat***********************
file [c:\testdir] exists!
file [c:\testdir] is directory!
file [c:\testdir] can be read!
file [c:\testdir] can not be writed!
***********test access***********************
file [c:\testdir] exists!
file [c:\testdir] can be writed!
file [c:\testdir] can be read!
结论:在VS2005中,使用access判断的只读目录却有【写入】的属性。
         有什么高招,欢迎解答。
建议,在VS2005中对文件、目录进行权限校验时,最好不要用access。
#include <stdio.h>
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
int main(int argc ,char *argv[])
{
struct stat buf;
int ret = 0;
int i=0;

char *file = "c:\\testdir";

printf("***********test stat***********************\n");
ret = stat(file, &buf );
if(ret != 0)
{
printf("stat [%s] fail, errno=%d\n", file, errno);
return -1;
}
else
printf("file [%s] exists!\n", file);

if((buf.st_mode&S_IFDIR)==0)
printf("file [%s] is not directory!\n", file);
else
printf("file [%s] is directory!\n", file);

if((buf.st_mode&S_IREAD)!=0)
printf("file [%s] can be read!\n", file);
else
printf("file [%s] can not be read!\n", file);

if((buf.st_mode&S_IWRITE)!=0)
printf("file [%s] can be writed!\n", file);
else
printf("file [%s


相关文档:

Sql Server 和 Access 操作数据库结构Sql语句

新建表:
create table [表名]
(
[自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,
[字段1] nVarChar(50) default '默认值' null ,
[字段2] ntext null ,
[字段3] datetime,
[字段4] money null ,
[字段5] int default 0,
[字段6] Decimal (12,4) default 0,
[字段7] image null ,
)
删除表:
Drop table [表 ......

C#操作ACCESS数据库(创建,压缩,备份,恢复)(转载)

下面这段C# 代码可以用来压缩和修复Access数据库,不管它是一个简单的".mdb"ACCESS数据库还是一个".mdw"网络共享数据库,这个过程和你在用MS Access应用程序中使用的"工具-数据库实用工具-压缩和修复"时执行的操作完全一样.实例代码使用了"迟绑定"(运行中在内存中建立COM对象),这样就不需要在工程中加入COM引用了,也不需要在P ......

Android: Requesting root access in your app

转帖:http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/
This snippet shows how root access can be requested inside an application in order to write a file into a place we do not have permission to access usually. Requesting root access will only work if your phon ......

备份和还原SQL Server及压缩Access数据库

*
 * 功能说明:备份和恢复SQL Server数据库
 * 作者: 刘功勋;
 * 版本:V0.1(C#2.0);时间:2007-1-1
 * 当使用SQL Server时,请引用 COM组件中的,SQLDMO.dll组件
 * 当使用Access中,请浏览添加引用以下两个dll
 *          引用C:/Progra ......

access数据库规格问题


Access 规格
Microsoft Access 数据库规格
Access 数据库
属性最大值
Microsoft Access 数据库 (.mdb) 文件大小
2G 字节减去系统对象所需的空间。
数据库中的对象个数
32,768
模块(包括“内含模块”属性为“是”的窗体和报表)
1,000
对象名称中的字符数
64
密码的字符个数
14
用户名 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号