changed interfaces of read*.h to return bool,
added php-like pathinfo, dirname, basename functions, pathinfo example
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#define VERBOSE
|
||||
#include "pathinfo.h"
|
||||
using namespace igl;
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
ifstream fin("input.txt");
|
||||
if (fin.is_open() == false)
|
||||
{
|
||||
// error
|
||||
return 1;
|
||||
}
|
||||
|
||||
string line;
|
||||
while( getline(fin, line) )
|
||||
{
|
||||
string dirname,basename,extension,filename;
|
||||
pathinfo(line,dirname,basename,extension,filename);
|
||||
printf("%s -> %s,%s,%s,%s\n",
|
||||
line.c_str(),
|
||||
dirname.c_str(),
|
||||
basename.c_str(),
|
||||
extension.c_str(),
|
||||
filename.c_str());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user