|
in the properties of the dialog there are options to make it resizable (its a combobox in styles tab)..
and it is a dialog based application.
|
|
|
|
|
Hi,
I know that if i do this; program1.exe > out.txt, all the output of program1.exe will be written to out.txt file (printf, cout).
But, what happens when i do program1.exe < input.txt? Imagine input.txt contains some data, how would i load the data into program1.exe with the above command? What C++ code should i write to handle that?
Also, if i do program1.exe < input.txt, the argc in main() will only return 1, that is program1.exe. Why not 3? (for program1.exe, <, and input.txt)
Explanantion appreciated. Thanks.
(I'm using win32 console app on VC++)
|
|
|
|
|
uus831 wrote: But, what happens when i do program1.exe < input.txt?
stdin is changed from the keyboard to input.txt
To read the data you can use anything that reads from stdin line scanf(), getch() etc
uus831 wrote:
Also, if i do program1.exe < input.txt, the argc in main() will only return 1, that is program1.exe. Why not 3? (for program1.exe, <, and input.txt)
Because the < input.txt is not an argument to your application, its an instruction to the os to modify what stdin points to
|
|
|
|
|
Note that stdin and stdout are also file handles. When no redirection occurs, stdin is the keyboard and stdout is the monitor.
In the form of program1.exe > out.txt , stdout is assigned with a file handle to the file out.txt, instead of the monitor. So all the output goes into out.txt instead of the monitor.
In the form of program1.exe < in.txt , stdin is assigned with a file handle to the file in.txt, instead of the keyboard. So whenever you read from stdin, e.g. when you call the scanf() function, the data come form in.txt, not the keyboard.
Redirecting is handled by the OS, not by the program, so the program itself will know nothing about the redirection, and redirection directives would be passed to program as parameters. Thus argc in main is 1, not 3.
|
|
|
|
|
Thanks for the info. But how do i determine how much data to read from the file? I mean, if the file in.txt contains 10 rows of data, how can i determine that i need to call scanf 10 times? Or, i cant?
|
|
|
|
|
uus831 wrote: But how do i determine how much data to read from the file? I mean, if the file in.txt contains 10 rows of data, how can i determine that i need to call scanf 10 times? Or, i cant?
To read file, I suggest you not to use DOS-shell indirection (< ) but use program arguments instead. Such as:
MyTest.exe -i "sample.txt"
or
MyTest.exe /i "sample.txt"
In the above example, your application handles the command-line arguments and gets the file name(s). Then you can use fstream to load the content of the whole file(s), or to read part of the file(s).
Maxwell Chen
|
|
|
|
|
Ok, thanks man. That's a better idea.
|
|
|
|
|
As the Windows built-in tool, fc.exe , it compares two files. The command for using this tool is as:
fc /b C:\Temp\hello.txt D:\Doc\hello_2.txt
Maxwell Chen
|
|
|
|
|
uus831 wrote: But how do i determine how much data to read from the file? I mean, if the file in.txt contains 10 rows of data, how can i determine that i need to call scanf 10 times?
fscanf() will tell you when it has read past the end of the file stream:
while (fscanf(stdin, ...) != EOF)
{
...
}
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I'm working on a MDI application and i need to display multiple child window. I don't know how to do it.
Hope somebuddy can give a comment.
Thanks.
|
|
|
|
|
I am using three different file types in my File Dialog.
Now when the User types in a file name and select a particular file
type from the drop down box and tries saving it, it doesn't save the
file type selection from the drop down box.
And also when i tried to get the file extension using the GetFileExt()
function it doesn't work.
Unless user types the file extension along the file name, this
function is not able to retrieve the file extension. How can this be
resolved?
Thanks in advance.
|
|
|
|
|
dipuks wrote: And also when i tried to get the file extension using the GetFileExt()
function it doesn't work.
Unless user types the file extension along the file name, this
function is not able to retrieve the file extension. How can this be
resolved?
Have you provided a default extension?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm not sure I'm in the right forum, if it's possible in C++ or if there's a program that does this. I'm trying to automatically compare and merge two .rtf documents and save it in a folder. The documents are the same name in different folders. I would like to know if there's a function call to use the attribute in word. Thanks for any comments or criticisms. Thanks
|
|
|
|
|
KirkNarine wrote: if it's possible in C++
Yes it is.
KirkNarine wrote: if there's a program that does this.
I don't know. Google might be able to help you discover that.
KirkNarine wrote: The documents are the same name in different folders.
That information is not relevant.
KirkNarine wrote: I would like to know if there's a function call to use the attribute in word.
I have no idea what that means.
KirkNarine wrote: Thanks for any comments or criticisms. Thanks
You are welcome. You're welcome
led mike
|
|
|
|
|
KirkNarine wrote: or if there's a program that does this.
Yes. Use WinMerge tool.
Maxwell Chen
|
|
|
|
|
Iam using MFC .In my project,I choose "single document" .while Iam writting,I have a problem that when I choose "File" on menu ,I continue to choose Open .MFC Program display me a dialog which help choose a file .And after I choose file,I don't know how do I get file path .Please help me.Thanks
Iam going to post pictures on forum,but I can't find where post it.Iam sorry
|
|
|
|
|
nvphap wrote: And after I choose file,I don't know how do I get file path .
Your document class has methods for retrieving that.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Your document class has methods for retrieving that.
Yeah, I think they still hide that information in the documentation.
led mike
|
|
|
|
|
may you speak clearly about which you reply to me,please .Thanks
|
|
|
|
|
From your document class(es), you can call CDocument::GetPathName() to get the full pathname.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
After I click button "open" to choose file ,the event or function where I will process to get file path,what is it's name? .Thanks
|
|
|
|
|
|
Override the CDocument::OnOpenDocument(LPCTSTR lpszPathName) function. The arguement contains the File Name which is selected in Open dialog
|
|
|
|
|
Hi friends,
I want to develop one business (back end exe to do functional computations and to get/store data into Oracle) application which i can develop either in Pro*C/C++ or C#.
Which language (Pro*C/C++ or C#) shall i chose ??? and why ???
which application will be more faster ?? and why ???
xyz
|
|
|
|
|
Amit4u wrote: Which language (Pro*C/C++ or C#) shall i chose ??? and why ???
Honestly, nobody cares which language you use. Choose the one which you know best. Both languages have good and bad aspects about them.
Amit4u wrote: which application will be more faster ?? and why ???
Generally speaking C++ generates slightly faster machine code, however with an Oracle DB application this really doesn't matter.
Best Wishes,
-David Delaune
|
|
|
|