|
楼主 |
发表于 2008-1-15 21:48:58
|
显示全部楼层
- // Create a temporary filename.
- ACE_FILE_Addr filename (ACE_sap_any_cast (ACE_FILE_Addr &));
- if (fn != 0)
- filename.set (fn);
- ACE_FILE_Connector connector;
- ACE_FILE_IO file;
- // Open up the file.
- if (connector.connect (file,
- filename,
- 0,
- ACE_Addr::sap_any,
- 0,
- ((writing) ? (O_RDWR | O_CREAT) : O_RDONLY),
- ACE_DEFAULT_FILE_PERMS) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("connect failed for %p\n"),
- filename.get_path_name ()),
- 1);
复制代码 用这种方式了!ACE中对文件的操作推荐用这种方法,ACE_OS::fseek()一类的操作只是为了提供对各平台的接口 |
|