I have a problem with the last text.It dosen’t appere

This is my code.

#include "pch.h"
#include <iostream>
#include <Windows.h> 
#include <string>
#include <ctime>
#include <fstream>

using namespace std;

std::string AppName = "League of Legends";
LPCSTR LAppWindow = "Riot Client";
std::string AppStatus;

bool IsAppAvil;
bool Update;

int main()
{
    //Start App
    ShellExecuteA(NULL,"open","D:\\Games\\Riot Games\\League of Legends\\LeagueClient.exe\\",NULL,NULL, SW_SHOWDEFAULT);

    //Checking if app is running
    HWND hGameWindow = NULL;
    int timeSinceLAstUpdate = clock();
    int AppAvailTMR = clock();
    int onePressTMR = clock();
    int Timer = 0;
    DWORD dwProcID = NULL;
    HANDLE hProcHandle = NULL;

    while(!GetAsyncKeyState(VK_ESCAPE))
    {
        Timer += 1;
        if (clock() - AppAvailTMR > 100)
        {
            AppAvailTMR = clock();
            IsAppAvil = false;

            hGameWindow = FindWindowA(NULL, LAppWindow);

            if (hGameWindow)
            {
                GetWindowThreadProcessId(hGameWindow, &dwProcID);
                if (dwProcID != 0)
                {
                    hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
                    if (hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
                    {
                        AppStatus = "Faild to open.Invalid HANDLE";
                    }
                    else
                    {
                        AppStatus = "App opend";
                        IsAppAvil = true;
                    }
                }
                else
                {
                    AppStatus = "Faild to open.Didn't get the process ID";
                }
            }
            else
            {
                AppStatus = "Faild to open.App not found";
            }
        }

            Sleep(1000);
            system("cls");
            cout << "-------------------------------------------------------------------" << endl;
            cout << "                      Auto App Loger" << endl;
            cout << "-------------------------------------------------------------------" << endl;
            cout << "APP STATUS: " << AppStatus << endl;
            cout << "[ESC] exit" <<endl;

    }

    return ERROR_SUCCESS;
}

void ReadTxt() 
{
    std::string line_;
    ifstream file_("Nam.Password.txt");
    if (file_.is_open())
    {
        std::cout << "Reading file" << '\n' << endl;
        while (getline(file_, line_))
        {
            std::cout << line_ << '\n' << endl;
        }
    }
    else
    {
        std::cout << "File not found" << '\n' << endl;
    }
}

How to store data from file redirect to new file using C

Hi all,

I am working on a project that should take all the data from file redirect and write them to a new file. Here is what I have:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "node.h"
#include "tree.h"

#define TRUE 0
#define FALSE 1
#define stdin stdin
#define stdout stdout
#define stderr stderr

    int main(int argc,char *argv[])
    {
    int i;
    FILE *fp;

    fp = fopen("result.out", "w"); //create file to write stdin data to. 

    if(fp == NULL) // file validation
    {
    printf("Could not open file");
    return 0;
    }

     if(argc == 1) // executes if command line has file redirect. 
    {
    printf("Getting data from file redirect. \n");
    fprintf (fp, "%s\n", stdin); //Print arguments from redirect to fp.

    }
     printf("Completed\n");
    return 0;
    }

This code will execute fine with no errors, but result.out is empty
The file being redirected only contains words separated by spaces.
I also never know the size of the file being redirected.
I just want to copy the data from the file being redirected to result.out.

Any suggestions on how I can improve the code?