Hallo all.
Iv spent a lot of time browsing through the old threads and I cannot find a solution to my problem. Please help...

I have to files
H:\me.txt
and
H:\you.exe
and I want to write a code in Turbo C++ to open these in a separate window, meaning I don't want the data that is in them to be incorporated into my program but for them to open and run themselves.

Not even my Software Design lecturer has any idea what to do here.
Your my last resort!!

Recommended Answers

All 6 Replies

So you want me.txt to open in notepad and you.exe to execute?

Well, as the txt file is non-executing, you will need to decide what program you wish to open it with.

You can then open the programs using CreateProcess using the correct parameters.

If your lecturer didn't know how to do this, I would be worried...

commented: Gave me a great site for C++ information +0

So you want me.txt to open in notepad and you.exe to execute?

Thats precisely what I want to do.

Well, as the txt file is non-executing, you will need to decide what program you wish to open it with.

You can then open the programs using CreateProcess using the correct parameters.

If your lecturer didn't know how to do this, I would be worried...

I'v spent many a night awake worrying.

I want to write a command in Turbo C++ that when executed the notepad file (me.txt) to open. Is there not just a simple command line that will do this?

I'v went through the link you set up for me, thank you, It solved a lot of other problems and it is a great site, but it didn't help with this.

CreateProcess will do exactly what you want to do. Another option is to use System(); but it's not recommended as you lose control of execution.

CreateProcess looks daunting, but it really isn't and it will help you further down the line if and when you want to control/monitor the applications you're running.

Thank you everyone for your help, but I found this and it helped me to solve the problem. Hope it'l help any one trying to do what I did.
fopen, very simple and it has an example you can just copy in and test.
www.cplusplus.com/reference/clibrary/cstdio/fopen/

have fun with it, I know I am...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.