Skip to content

Commit dc28d30

Browse files
committed
Add file system
1 parent 72c5275 commit dc28d30

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

fs/SConstruct

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
env = Environment(CCFLAGS='-g')
2+
3+
env.Program('about_stat.cpp')

fs/about_stat.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <iostream>
2+
#include <sys/types.h>
3+
#include <sys/stat.h>
4+
#include <unistd.h>
5+
#include <string.h>
6+
#include <errno.h>
7+
8+
void AboutStat(const char* FilePath)
9+
{
10+
struct stat Buf;
11+
12+
if (stat(FilePath, &Buf) != 0)
13+
{
14+
std::cout << "fail to stat " << FilePath << std::endl;
15+
std::cout << strerror(errno) << std::endl;
16+
return;
17+
}
18+
19+
std::cout << "file: " << FilePath << std::endl;
20+
std::cout << "inode: " << Buf.st_ino << std::endl;
21+
}
22+
23+
int main(int argc, char* argv[])
24+
{
25+
AboutStat(argv[1] ? argv[1] : __FILE__);
26+
27+
return 0;
28+
}

palindrome/find_word.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ void solution(std::string str, std::vector<std::string> WordList)
117117

118118
if (FindPos != std::string::npos)
119119
{
120+
//if (PosLengthMap.find(FindPos) != PosLengthMap.end())
121+
// continue;
122+
120123
if (isInRange(PosLengthMap, FindPos, WordList[i].size()))
121124
continue;
122125
PosLengthMap[FindPos] = WordList[i].size();

0 commit comments

Comments
 (0)