Search code examples
c++stringfunctionfunction-calls

I want to call my function with string parameter


void GenerateDecryptedData("/home/merve/merve.enc", "/home/merve/merve.dec","dEneMe!1234");

I want to call my function like dEneMe!1234.

void GenerateDecryptedData(const char* pathToEncryptedFile, 
                        const char* pathToDeccryptedFile,
                        std::string Pwd);

But when I wrote the function prototype like this, I'm taking string has not been declared- error! How can I take my password in string type?


Solution

  • You need the string header at the top of your source file: #include <string>. I'd consider Googling error messages more often. :)

    string header - http://www.cplusplus.com/reference/string/
    cstring header - http://www.cplusplus.com/reference/cstring/