mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 12:58:40 +00:00
feat(judger): add "x bytes omitted" info
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cea0e82db8
commit
74127afe25
@ -133,6 +133,9 @@ string file_preview(const string &name, const int &len = 100) {
|
||||
return "";
|
||||
}
|
||||
|
||||
struct stat stat_buf;
|
||||
stat(name.c_str(), &stat_buf);
|
||||
|
||||
string res = "";
|
||||
if (len == -1) {
|
||||
int c;
|
||||
@ -145,8 +148,9 @@ string file_preview(const string &name, const int &len = 100) {
|
||||
res += c;
|
||||
}
|
||||
if ((int)res.size() > len + 3) {
|
||||
int omitted = (int)stat_buf.st_size - len;
|
||||
res.resize(len);
|
||||
res += "...";
|
||||
res += "\n\n(" + to_string(omitted) + " bytes omitted)";
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
|
@ -130,6 +130,9 @@ string file_preview(const string &name, const int &len = 100) {
|
||||
return "";
|
||||
}
|
||||
|
||||
struct stat stat_buf;
|
||||
stat(name.c_str(), &stat_buf);
|
||||
|
||||
string res = "";
|
||||
if (len == -1) {
|
||||
int c;
|
||||
@ -142,8 +145,9 @@ string file_preview(const string &name, const int &len = 100) {
|
||||
res += c;
|
||||
}
|
||||
if ((int)res.size() > len + 3) {
|
||||
int omitted = (int)stat_buf.st_size - len;
|
||||
res.resize(len);
|
||||
res += "...";
|
||||
res += "\n\n(" + to_string(omitted) + " bytes omitted)";
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
|
Loading…
Reference in New Issue
Block a user