⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testfs.cpp

📁 Sector is a system infrastructure software that provides functionality for distributed data storage,
💻 CPP
字号:
#include <fsclient.h>#include <iostream>using namespace std;using namespace cb;int main(int argc, char** argv){   Sector::init(argv[1], atoi(argv[2]));   File* f1 = Sector::createFileHandle();   if (NULL == f1)      return -1;   if (f1->open("test.txt", 1) < 0)   {      cout << "error to open file." << endl;      return -1;   }   char buf[1024];   f1->read(buf, 0, 10);   string test = "**********Hello World!";   f1->write(test.c_str(), 20, test.length());   f1->close();   f1->open("test.txt");   int res = f1->read(buf, 0, 10);   buf[10] = '\0';   cout << "res = " << res << " " << buf << endl;   f1->write(test.c_str(), 20, test.length());   f1->close();   f1->open("test.txt");   f1->read(buf, 0, 10);   f1->write(test.c_str(), 20, test.length());   f1->close();   Sector::releaseFileHandle(f1);   CFileAttr attr;   Sector::stat("test.txt", attr);   cout << attr.m_pcName << " " << attr.m_llSize << endl;   Sector::stat("rate.txt", attr);   cout << attr.m_pcName << " " << attr.m_llSize << endl;   Sector::close();   return 1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -