A program that modifies a string inside its exe

I am looking for an example program that modifies a string inside my exe.

I work with C ++, Visual Studio on Windows.

I searched for working examples on Windows, but I can not find any working code.

I need a simple code that will ask the user for a string:

string strTest = "";
(if strTest != "")
{
   cout << "Modified: " << strTest << endl;
}
cin >> strText;

And the code should be rewritten:

string strTest = "";

To dial the specified user:

string strTest = "SomeStringFromUser"; 

How in C ++ do you change the string (from the string strTest = ") to the string that the user entered? (For example strTest =" foo ")?

+3
source share
3 answers

EXE Windows, exe CreateFileMapping , READONLY, COPY_ON_WRITE.

, exe , . , . , EXE .

, COPY_ON_WRITE - , . , , - , exe .exe .

, , , .

--- ----

, . exe. , exe. EXE , .

.

  • , const char g_szWatermark[100] = "";
  • exe, , ( ++)
  • EXE, , exe.
  • , exe ,
  • , , .exe. : exe, !
+15

, , , . -, PKI, , .

, , R & D, , . , , , .

, , - GUID " " .

+2

How about this:

#include <string>
#include <iostream>

int main()
{
    std::string strTest = "";
    std::getline(std::cin,strTest);

    if (strTest != "")
    {
        std::cout << "Modified String: " << strTest << "\n";
    }
    else
    {
        std::cout << "Not modified\n";
    }
 }
0
source

Source: https://habr.com/ru/post/1726473/


All Articles