本文整理汇总了C++中fs::path::remove_filename方法的典型用法代码示例。如果您正苦于以下问题:C++ path::remove_filename方法的具体用法?C++ path::remove_filename怎么用?C++ path::remove_filename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fs::path
的用法示例。
在下文中一共展示了path::remove_filename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trash
void trm::Database::createEntry(fs::path path, fs::path trashPath, std::size_t size)
{
sqlite3_stmt *stmt;
std::string objectName = trashPath.filename().string();
const char *cPath = path.remove_filename().c_str();
char sql[] = "INSERT INTO trash (OBJECTNAME, FILESIZE, TRASHPATH, OLDPATH, DELETEDAT) "
"VALUES (?, ?, ?, ?, datetime('NOW', 'localtime'));";
dbStatus = sqlite3_prepare(db, sql, -1, &stmt, 0);
if (dbStatus != SQLITE_OK)
{
std::cout << "Database Error: " << errMsg << std::endl;
exit(0);
}
if (sqlite3_bind_text(stmt, 1, objectName.c_str(), -1, SQLITE_STATIC) != SQLITE_OK)
std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;
if (sqlite3_bind_int(stmt, 2, static_cast<int>(size)) != SQLITE_OK)
std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;
if (sqlite3_bind_text(stmt, 3, trashPath.c_str(), -1, SQLITE_STATIC) != SQLITE_OK)
std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;
if (sqlite3_bind_text(stmt, 4, cPath, -1, SQLITE_STATIC))
std::cout << "Database Bind Error: " << sqlite3_errmsg(db) << std::endl;
if (sqlite3_step(stmt) != SQLITE_DONE)
std::cout << "Database Execute Error: " << sqlite3_errmsg(db) << std::endl;
}