Overview
Features
Download
Documentation
Community
Add-Ons & Services

*Newbie* Starting with C++ POCO

Please post support and help requests here.

*Newbie* Starting with C++ POCO

Postby AxDSan » 29 Aug 2013, 18:59

I just found a sample POCO has in its support page, and it's like this:

Code: Select all
#include "Poco/File.h"
#include "Poco/Path.h"
#include <iostream>
using Poco::File;
using Poco::Path;
int main(int argc, char** argv)
{
   std::string tmpPath(Path::temp());
   tmpPath.pushDirectory("PocoFileSample"); //ERROR GOES HERE
   File tmpDir(tmpPath);
   tmpDir.createDirectories();
   bool exists = tmpDir.exists();
   bool isFile = tmpDir.isFile();
   bool isDir = tmpDir.isDirectory();
   bool canRead = tmpDir.canRead();
   bool canWrite = tmpDir.canWrite();File tmpFile(Path(tmpPath, std::string("PocoFileSample.dat")));
   if (tmpFile.createFile())
   {
      tmpFile.setSize(10000);
      File tmpFile2(Path(tmpPath, std::string("PocoFileSample2.dat")));
      tmpFile.copyTo(tmpFile2.path());
      Poco::Timestamp now;
      tmpFile.setLastModified(now);
      tmpFile.setReadOnly();
      canWrite = tmpFile.canWrite();
      tmpFile.setWriteable();
      canWrite = tmpFile.canWrite();
   }std::vector<std::string> files;
   tmpDir.list(files);
   std::vector<std::string>::iterator it = files.begin();
   for (; it != files.end(); ++it)
   {
      std::cout << *it << std::endl;
   }
   tmpDir.remove(true);
   return 0;
}


But it's giving me an error saying:
Error 1 error C2039: 'pushDirectory' : is not a member of 'std::basic_string<_Elem,_Traits,_Alloc>' C:\Development\poco-1.4.6p1\Projects\PocoConsoleApplication2\PocoConsoleApplication2\Source.cpp 9 1 PocoConsoleApplication2


in other words saying that std::string does not contains the 'pushDirectory' member but Path has it... How can I fix this error?


Thanks for any help in advance :D
AxDSan
 
Posts: 2
Joined: 29 Aug 2013, 18:48

Re: *Newbie* Starting with C++ POCO

Postby AxDSan » 30 Aug 2013, 21:44

Nevermind people, I fixed it by my own, I easly fixed this, replacing 'pushDirectory' to append
AxDSan
 
Posts: 2
Joined: 29 Aug 2013, 18:48


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron