0

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?

2
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by tayyabatiq
0

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?

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.