This code is supposed to write everything the user writes, and keep writing until the user presses ALT key.

do{
        //declaration
        string A;
        getline(cin,A);
        ofstream file;
        ifstream file1;

        //file opening
        file.open("C:\\Dev-Cpp\\file.txt");
        file1.open("C:\\Dev-Cpp\\file.txt");

        //file input
        file<<A;
        file.close();
        file1.getline(B,1000);
        file1.close();

        //file output
        cout<<B;

    } while (wParam!=VK_MENU);

The problem is, it says: wParam undeclared!
I want to keep checking the last key pressed, without disturbing the input. Anyone got any solution?

You never define wParam which is why it fails to compile. You need to give it a type and assign it a value (it is never used outside of the check, so you need to give it a value somewhere). What do you mean when you say "without disturbing the input." If you buffer the input in a variable you can read it without changing the value you read?

How to define wParam? Please add the line in my program, i've been searching for its right use everywhere but couldnt find :(

I've also tried this:

switch(A){
                     case WM_KEYDOWN:
                          switch (wParam){ 
                                 case VK_LEFT: cout<<"LEFT";
                                 break;
                                 }
                     break;
                     }

but still says wParam not defined

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.