本文整理汇总了C++中BFile::Dup方法的典型用法代码示例。如果您正苦于以下问题:C++ BFile::Dup方法的具体用法?C++ BFile::Dup怎么用?C++ BFile::Dup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFile
的用法示例。
在下文中一共展示了BFile::Dup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
test_remove_attributes(BFile& file, int32 start, int32 count, int32 removeAt,
int32 removeIndex1, int32 removeIndex2)
{
int fd = file.Dup();
if (fd < 0)
return;
int32 index = 0;
bool seen[4096] = {0};
if (gVerbose)
printf("test removeAt %ld\n", removeAt);
DIR* dir = fs_fopen_attr_dir(fd);
while (struct dirent* entry = fs_read_attr_dir(dir)) {
if (gVerbose)
printf(" %ld. %s\n", index, entry->d_name);
if (index == removeAt) {
if (removeIndex1 > 0)
remove_marker_attribute(file, removeIndex1);
if (removeIndex2 > 0)
remove_marker_attribute(file, removeIndex2);
}
index++;
if (is_marker(entry->d_name))
continue;
int32 attributeIndex = attribute_index(entry->d_name);
if (attributeIndex > 0) {
if (seen[attributeIndex]) {
printf("attribute index %ld already listed!\n", attributeIndex);
exit(1);
} else
seen[attributeIndex] = true;
}
}
fs_close_attr_dir(dir);
close(fd);
for (int32 i = start; i < start + count; i++) {
if (!seen[i]) {
printf("attribute index %ld not listed, saw only %ld/%ld!\n", i,
index, count);
exit(1);
}
}
}