By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,412 Members | 993 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,412 IT Pros & Developers. It's quick & easy.

Opening Program and Passing Data

compman9902
100+
P: 105
Hello, and thank toy for reading this post.
Thus far, this website has helped me a lot,
(I have finally finished my encryptor: "site removed by moderator", go to the downloads link) and I will continue asking for help (so my rank may finally increase).
Right now the topic at hand for me is opening file dialogs. Right now, the issue at hand is opening up a fully functional G.U.I. file prompt (both for opening and saving files please) that has a filter for Windows Text (.TXT) files.
Also, it would be helpful if someone could give me some code for opening up notepad and displaying a string variable file in it (The string variable being a variable that is a string containing the file path). So the user dosn't have to press open and all that stuff, it comes pre-opened. Well, I have writen no code and I really hope that someone (or more) can help me with these issues.


My information:

Operating System: Windows XP Home Edition (Service Pack Two)
Compiler/I.D.E. :Bloodshed DEV-C++ Version 4.9.9.2

Thank You
--Parker Woods
Apr 3 '07 #1
Share this Question
Share on Google+
9 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Hello, and thank toy for reading this post.
Thus far, this website has helped me a lot,
(I have finally finished my encryptor: "site removed by moderator", go to the downloads link) and I will continue asking for help (so my rank may finally increase).
Right now the topic at hand for me is opening file dialogs. Right now, the issue at hand is opening up a fully functional G.U.I. file prompt (both for opening and saving files please) that has a filter for Windows Text (.TXT) files.
Also, it would be helpful if someone could give me some code for opening up notepad and displaying a string variable file in it (The string variable being a variable that is a string containing the file path). So the user dosn't have to press open and all that stuff, it comes pre-opened. Well, I have writen no code and I really hope that someone (or more) can help me with these issues.


My information:

Operating System: Windows XP Home Edition (Service Pack Two)
Compiler/I.D.E. :Bloodshed DEV-C++ Version 4.9.9.2

Thank You
--Parker Woods
So you are trying to carete a GUI? I'm not sure I understand your question there.

As for notepad, I think you can use 'system("notepad") to start it, but I'm not sure about pasting the string in there - you might be able to pass it as a command line option...
Apr 3 '07 #2

compman9902
100+
P: 105
So you are trying to carete a GUI? I'm not sure I understand your question there.

As for notepad, I think you can use 'system("notepad") to start it, but I'm not sure about pasting the string in there - you might be able to pass it as a command line option...
I'm not trying to create a GUI, just a console program. But my users and I both agree that it would be easier for a file dialog instead of manually typing in the file path.
As for the notepad thing, I've tried this:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. system("notepad " << filePath);
  3. and
  4. system("notepad filePath")
  5.  
and it didn't seem to work. Any suggestions are greatly appreciated. Also, whats not to get about the question?
Apr 3 '07 #3

sicarie
Expert Mod 2.5K+
P: 4,677
I'm not trying to create a GUI, just a console program. But my users and I both agree that it would be easier for a file dialog instead of manually typing in the file path.
As for the notepad thing, I've tried this:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. system("notepad " << filePath);
  3. and
  4. system("notepad filePath")
  5.  
and it didn't seem to work. Any suggestions are greatly appreciated. Also, whats not to get about the question?
Right, just appending the path won't work - I'd recommend looking through the Win32 API to see if there's an easy way to do this, or if it's even in there.
Right now, the issue at hand is opening up a fully functional G.U.I. file prompt (both for opening and saving files please) that has a filter for Windows Text (.TXT) files.
You want to create a prompt on a text screen, or make a GUI? It seems like you want to have a prompt on some command prompt for a user to input a filename, and then have that file be opened in notepad. I'm sorry, I'm probably over-complicating this in my head...
Apr 3 '07 #4

sicarie
Expert Mod 2.5K+
P: 4,677
Maybe a simple explanation of how you would like the program to proceed would help - I'm not sure at what point you want notepad to open, if it's when the user inputs a file, or if you want to try to use that to capture the filename.
Apr 3 '07 #5

compman9902
100+
P: 105
Maybe a simple explanation of how you would like the program to proceed would help - I'm not sure at what point you want notepad to open, if it's when the user inputs a file, or if you want to try to use that to capture the filename.
Okay. Thank you for you help, but you are over-complicating things. Heres what I want.
The program opens, then it asks for a text file path, but it retrieves it by using the GUI interface of the common open file dialog. Then, it completes its processes with the text file, then it saves it to a certain path using the common file dialog. Then, it asks if you would like to read it using the "system(notepad)" command.
Apr 8 '07 #6

sicarie
Expert Mod 2.5K+
P: 4,677
Okay. Thank you for you help, but you are over-complicating things. Heres what I want.
The program opens, then it asks for a text file path, but it retrieves it by using the GUI interface of the common open file dialog. Then, it completes its processes with the text file, then it saves it to a certain path using the common file dialog. Then, it asks if you would like to read it using the "system(notepad)" command.
Yeah, I was trying to get a more clear explanation. I've edited the thread so that jj555 wasn't hijacking it, as his question was a bit different, and edited the title of the thread (let me know if you don't think it is adequately descriptive enough). Off the top of my head I don't have much experience with the common open file dialog, if that accepts paramaters, if one of those can be data, etc... I'm sure there's a way to do it (and meanwhile, if anyone does know, please post!), so I'll look into it - just wanted to put an update on the splitting/re-titling of the thread (and bump this back to the top).
Apr 8 '07 #7

compman9902
100+
P: 105
Yeah, I was trying to get a more clear explanation. I've edited the thread so that jj555 wasn't hijacking it, as his question was a bit different, and edited the title of the thread (let me know if you don't think it is adequately descriptive enough). Off the top of my head I don't have much experience with the common open file dialog, if that accepts paramaters, if one of those can be data, etc... I'm sure there's a way to do it (and meanwhile, if anyone does know, please post!), so I'll look into it - just wanted to put an update on the splitting/re-titling of the thread (and bump this back to the top).
Okay, thank you.
I still need help on this so PLEASE post.
Apr 9 '07 #8

weaknessforcats
Expert Mod 5K+
P: 9,197
You cannot use a GUI on a console application.

By definition, rthe console is character based since it's is an actual console with a keyboard.

If you need a GUI, you will need to write a Windows program. See "Programming Windows" by Charles Petzold.
Apr 9 '07 #9

dfound
P: 52
Hi, I don't know whether it will work , but try this.


char command[100];//you can vary size
strcpy(command,"notepad "); // there is a space after notepad
strcat(command,filepath);
system(command);


I had tried the above to open a file containing window.
I used "explorer " instead of "notepad"
It might work. .... :-)
Apr 9 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.