I want to read sentence from command line. I open some program which run in command line and I have to wait for that program process. So , I don't know when process success .I can't type next command if can't read sentence from command. I use
Code:
wprintf(GetCommandLine());
but it show
"C:\Users\PKRU\documents\visual studio 2010\Projects\Virus Scan\Debug\MyProgram
please help me How to read sentence from Command line with MFC ?
D:\Temp\80>cl 80.cpp /D"UNICODE" /D"_UNICODE"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
80.cpp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:80.exe
80.obj
D:\Temp\80>80.exe iuhbiub oiono
D:\Temp\80\80.exe iuhbiub oiono
Re: How to read sentence from Command line with MFC?
Thank you for answer. I use this code in VC
int _tmain()
{
system("D:");
_tprintf(GetCommandLine());
getch();
return 0;
}
but when I click run button it show "C:\Users\MAX\Documents\Visual Studio 2010\Projects\TestCmd\Debug\TestCmd.exe"
I read CCommandineInfo the function ParseCommandLine can send parameter from command to MFC, But I want to know when my console process success and ask for send Y/N to command. If MFC can know when it ask Y/N ,then I can send char to process next command.
Re: How to read sentence from Command line with MFC?
Originally Posted by mmc01
but when I click run button it show "C:\Users\MAX\Documents\Visual Studio 2010\Projects\TestCmd\Debug\TestCmd.exe"
And what did you expect? This is exactly the command line your process has been run with. Do you have any idea what command line is? I wonder what sense that system("D:"); makes for you?
I read CCommandineInfo the function ParseCommandLine can send parameter from command to MFC, But I want to know when my console process success and ask for send Y/N to command. If MFC can know when it ask Y/N ,then I can send char to process next command.
You're trying to do something you have no idea about. You cannot program Windows without knowing how the very basic OS mechanisms work.
When program exits it always provides exit code specific to the circumstances of termination. By the code value any outer process can tell if the exit was successful or not, and typically 0 means success (a UNIX/POSIX legacy). But the part about MFC knowing something and sending another something sounds totally gibberish. This is what you have to explain, if you want to be really helped.
Last edited by Igor Vartanov; February 11th, 2013 at 12:17 PM.
Bookmarks