Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6139365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:58:50+00:00 2026-05-23T17:58:50+00:00

In my program i declared a function prototype like : void callToPrint(LPTSTR , LPVOID

  • 0

In my program i declared a function prototype like :

void callToPrint(LPTSTR , LPVOID , DWORD , string )

But i get the following error due to this statement : error C2061: syntax error : identifier 'string'

There are other errors also in the code which tell that the function does not take 4 arguments.

(error C2660: 'callToPrint' : function does not take 4 arguments)

Why do i get this error ? And how can i fix them ?

My second question is :

  • I have declared a variable nameofPrinter of type LPTSTR but when i write the statement getline( cin , nameOfPrinter ) , the error displayed is no instance of overloaded function getline matches the argument list. Then how can i receive the nameOfPrinter from the user ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:58:51+00:00Added an answer on May 23, 2026 at 5:58 pm

    Your file needs to contain the following line:

    #include <string>
    

    The header file string contains the definition for the string class. Because that class is within the std namespace the function prototype needs to be:

    void callToPrint(LPTSTR , LPVOID , DWORD , std::string );
    

    Since you’re using LPTSTR in the prototype you must be using Visual C++. If your project is set to use Unicode charset instead of multi-byte char set you need to adapt your types accordingly.

    For Unicode charset:

    std::wstring nameOfPrinter;
    std::getline( std::wcin , nameOfPrinter );
    

    Or, you could declare the type of your strings as:

    std::basic_string<TCHAR> nameOfPrinter;
    

    Unfortunately, such a templated class does not exist for switching between cin and wcin. So you’ll have to resort to the preprocessor.

    #if defined(UNICODE) || defined(_UNICODE)
      #define _tcin wcin
    #else
      #define _tcin cin
    #endif
    
    std::basic_string<TCHAR> nameOfPrinter;
    std::getline( std::_tcin , nameOfPrinter );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In following program . I have one doubt. I have declared one global variable
i declared classes like this: class Foo{ public function __construct(){ echo 'Foo was created!';}
When I try to compile my program I get these errors: btio.c:19: error: ‘O_RDWR’
Can the main() function be declared static in a C program? If so then
Why does the following program give me an declaration error? Aren't I declaring it
how can one called function in c++ program where function is declared in other
I have declared a DLL import in my C# program that looks like this:
I know when a program is run, the main() function is executed first. But
My program generates relatively simple PDF documents on request, but I'm having trouble with
My Program overrides public void paint(Graphics g, int x, int y); in order to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.