C++ :: How To Open Command Window At The Folder Containing EXE File

May 26, 2013

This is the code

#include <iostream>
using std::cout;
using std::endl;
int main(int argc, char* argv[])

[Code] ...

The only Problem I have is that I need to know how to open a command window at the folder containing the .exe file(this program), inorder to enter the program name or arguments.

View 2 Replies


ADVERTISEMENT

C# :: How To Create A Window Where User Can Open A File

Dec 15, 2014

I am using

string text = System.IO.File.ReadAllText(@"C:datainput.txt");

to open a file and save it content to "text"

How can I instead create new window where user will select the .txt file he wants to read like many applications do

This is a WPF application

View 10 Replies View Related

C++ :: Absolute Path Reference - Open File And Print Contents To Terminal Window

May 12, 2014

I am trying to open a file and print the contents of the file to the terminal window. It works when I put the file right in the directory with the Solution but not if the file is out on my desktop and I use the full path. Here is the code:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int OpenFile(){
fstream SampleFile;

[Code] .....

View 5 Replies View Related

Visual C++ :: Command For List Out Shared Folder In MFC?

Apr 12, 2013

I need to list out all the shared folders(directory) in the system along with their path . i want a command or an api in MFC, for listing out the shared directories.

View 2 Replies View Related

C :: Running A VBS Script Int Without Command Window

Dec 19, 2014

I have created an scientific calculator application and I have a VBS script that runs some of the files. I want to create a C program that runs that VBS script. however, a command window flashes before the application opens. So basically I need a short C (or C++) program that runs a VBS script without a command window popping up. I am on Windows 8 and my compiler is GCC/G++ under cygwin. Here is what I have now that DOES NOT work.

Code:

#include <windows.h>
int main()
{
ShellExecute( NULL, NULL, "StartUp.vbs", NULL, NULL, SW_HIDE);
return 0;
}

View 2 Replies View Related

C++ :: How To Open A Window Maximized

Apr 28, 2014

There is only one thing I need here. When the paint program is opened I need it to automatically open it maximized. Other than that my code works perfectly for what I'm trying to build.

It has to be maximized so when a friend opens it after I send it to him, it auto maximizes and doesn't start drawing on his desktop.

#include <iostream>
#include <Windows.h>
using namespace std;
int main() {
system("start C:/Windows/System32/mspaint.exe");
FreeConsole();
Sleep(1000);

[Code] .....

View 3 Replies View Related

C++ :: Opens New Command Prompt Window For Input?

Oct 8, 2014

If I compile code which uses cin using the command prompt, then run the compiled program a new window opens when it reaches the cin line of code, for the input. If there is no cin used then all printing happens in the original window. Is there a way to stop this behavior of the opening of a new window?

View 1 Replies View Related

C/C++ :: Command Prompt Window Disappears Before Output?

Jan 14, 2013

this is my program, it works fine when asking for inputs, but as soon as i press enter for the output the window just dissapers.

#include<stdio.h>
main()
{int bno;

[Code].....

View 2 Replies View Related

C++ :: Keeping Output Window Open

Jun 24, 2014

My program accepts strings, places them in a vector and then "bleeps!" out words of my choosing, in this case, "broccoli". But I'm having trouble keeping the output window open even with my Keep_window_open() implementation.

#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "cmath"
using namespace std;

[code]....

View 2 Replies View Related

C++ :: How To Make CMD Window Pop Up When Open A Game

Dec 20, 2014

I wanna know how to do so a cmd window when you open a game.

Example: when I start cheese attack (just a name I like) then a cmd window come up, how do I do that?

View 1 Replies View Related

C# :: How To Select Open Application Window

Feb 10, 2015

this is my app interface as in attachment when i click an arrow it split the current selected window in arrow direction.

i want to know how to pass the current window to my button... i tried it using

Process[] processlist = Process.GetProcesses();

but it wont works

View 3 Replies View Related

C/C++ :: Make Basic Snake Game Using Command Window And Screen Refreshes?

Apr 15, 2015

I am trying to make a basic Snake game using the command window and screen refreshes. So far I have a board, snake, food, and no walls. Basically I have it so the snake moves like the traditional snake in the game, when it eats the food once it grows. However when it eats the food a second time the game crashes. I think I have narrowed the issue down to the grow array that I have (below) but I am not sure if the issue could be a result of something else.

Grow Array

cord growArray (cord *p_values, int *size)
{
*size = *size + 1;
cord *p_new_values = new cord[ *size ];

[Code]....

View 7 Replies View Related

C# :: Open WPF Window From Double Click On Selected Item In A List?

Apr 23, 2015

I have a list with 2 items in it. When I double click on item 1, I want to open Window1.xaml, when I double click on item 2, I want to open Window2.xaml...

The code below works for popping up a message box, or window for that matter. But I really need to get the Window1 and Window2 based on the clicking of the correct selected item in the list.

Here is some code:

<ListView d:DataContext="{d:DesignData }" Name="PharmacyLv" IsSynchronizedWithCurrentItem="True" l:Sortbehavior.CanUserSortColumns="true" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<EventSetter Event="MouseDoubleClick" Handler="ListViewItem_PharmDoubleClick" />
</Style>
</ListView.ItemContainerStyle>

[code].....

View 3 Replies View Related

C/C++ :: Count Files And Directories In Root Folder With Every Folder Information

Jul 25, 2013

I need a code in c++ . It should count the Files and Directories in root folder with every folder information i need the below information

1) no of files and folder
2) how many files are there in each folder
3) with size of every folder and files it contains

I am new in c++ ....

View 1 Replies View Related

C++ :: Get Last Line Displayed By Another Command Line Window

Apr 14, 2013

I write a program which now works perfectly well. However, I want to make it run at the right time automatically, instead of waiting for a user to start it when needed.

The basic problem is, that in a WinPE environment an exe is running. Unfortunately it would need critical input, which must be inputted perfectly. So, I wrote a program which gets the data and sends it to the other app, by bringing it to the front and presses the keys needed using SendInput().

However, this program should wait for it's cue, then get on the inputting part. It's cue should be the point where the program waits for the first user input with this displayed on the last line:

Text:

My question is: how to listen and check whether the last line displayed is "Text:"?

I've tried with AttachConsole(), but for some reason it opens a new console window. I checked and the PID I'm using is the console window's, so I don't know why that happens.

The few lines I'm trying with:

HWND hwnd = FindWindow(NULL, "Administrator: Command Prompt");
SetForegroundWindow(hwnd);
SetFocus(hwnd);
DWORD process_id;
GetWindowThreadProcessId(hwnd, &process_id);

[Code] ...

Please don't criticize the first line. I know it can be ambiguous, but I modified it, When actually using it, the exe name will be in the title, so it will be unique.

View 4 Replies View Related

C++ :: How To Import A File From Another Folder

Nov 1, 2013

I want to make a launcher for my program but the installation folder is different from one computer to another so I need a function or something that shows the path of the executable file.how to import a file from another folder.

#include<stdio.h>
int main(void)
{
FILE *fp;
*fp=fopen("C:Documents and Settings...something.txt","r");
}

You see I want to set the import path.

View 1 Replies View Related

C# :: How To Install File One By One In Folder

Aug 23, 2014

i get the name of file upon every OK click in the list of array.

i want the file name to be written in command prompt to install the file like

C:WindowsSystem32msiexec.exe filename.exe /quiet

fi is array representing the files

following is a code ..

foreach (FileInfo fiTemp in fi)
{
p2.StandardInput.Write("msiexec.exe ");
p2.StandardInput.Write(fiTemp.Name);
MessageBox.Show(fiTemp.Name);
}

View 7 Replies View Related

Visual C++ :: How To Tell If File Or Folder Could Be Placed Into Recycle Bin

May 18, 2014

Say, I have the "K: est del USB" folder.

Then I do the following:

Code:
SHFILEOPSTRUCT sfo = {0};
sfo.wFunc = FO_DELETE;
sfo.pFrom = L"K: est del USB";
sfo.fFlags = FOF_ALLOWUNDO |

[Code] ....

So when I run it, the SHFileOperation API shows this warning:

Are you sure you want to permanently delete this folder?

If the end-user clicks "No", SHFileOperation return 0x4c7, which I believe is ERROR_CANCELLED.

My question is, if I don't need any UI, how can I know that my file/folder will be permanently deleted vs. placed into the Recycle Bin?

View 11 Replies View Related

C :: Function That Gets As Parameter File And Folder Path

Oct 18, 2014

I'm writing a small function that gets as parameter a file's path and a folder's path, and copies the given file to that folder.

Code:
int copy_file(const char* source, const char* folder) {
char copy[PATH_MAX];
strcpy(copy, folder);
strcat(copy, "/");
strcat(copy, source);

[Code] ....

Basically, this function purpose is to make a backup of source in folder every X minutes (depending on user's input).

The problem is the second call to open():

This call attempts to open the file for writing, and creates it if it is not already exist.

It also truncates it before writing to it - and that's my concern:

Let's say this is the second time this function runs, so copy is already exist. open() will then truncate it, and then one of the system calls in the while loop fails.

In this situation, I might be left with no backup file.

The problem also arises for when source is a read-only file:

If source is a read-only file, and copy is not already exist (meaning - it's the first backup attempt), then everything's fine, but, if source is a read-only file and copy is already exist, then I have to first remove copy altogather, and make a fresh copy of source.

Making a backup with new name for copy every time copy_file() runs, will solve this problem, and how can this be accomplished?

I should say that I'd really prefer that copy and source will have the same names when copy_file() returns...

View 5 Replies View Related

C++ :: Getting Thumbnails (with Large Icons) Of Folder Not File

Nov 5, 2014

I am searching an API that can give me thumbnail(with large Icons) of all folders of all drive in Windows 7. Like

c:/--->Folder1,Folder2.....FolderN
d:/--->Folder1,Folder2.....FolderN
.
.
n:/--->Folder1,Folder2.....FolderN

How i can get associate thumbnail(with large Icons) of each folders of any of the drive.

View 5 Replies View Related

C++ :: Calling Header File From A Centralized Folder

May 27, 2014

Scenario as below:

I have two module, A and B

Module A:
- A.cpp & A.h

Module B:
- B.cpp & B.h

and then for these two *.h file i put in another centralized folder call HeaderFile.

when I #include "B.h" from A.cpp, the compiler show me Error code C1083.

View 3 Replies View Related

C/C++ :: Change Access To The Folder On File System?

Aug 27, 2014

I want to delete the folder from the file system, but I am getting error of access permission.

I want to change the permission of the folder so my program can delete it.

The problem I am facing on google search is I am getting results mostly for MFC code which is windows specific. However, I want to write a code in core C++ that works on all platforms like unix and windows.

View 12 Replies View Related

C# :: Saving Excel File In D Drive New Folder?

Jul 17, 2014

I am trying to save the excel file in D:/newfolder. but the file saving as newfolderFilename. The newfolder is already created in D drive. File save path i am getting from textbox ....

View 14 Replies View Related

C# :: Creating Service To Monitor And Read Contents Of File From A Folder

Feb 10, 2015

am trying to create a service that will try to create a service that will monitor a folder. Whenever a new file gets created, I am trying to read the contents of new file and copy contents (with same file) at a new location.

The problem I am facing is that only first file that gets its name copied and a file created at a new location, but without any contents. The subsequent files do not get created at all.

My Services.cs looks like this:-

public partial class Service1 : ServiceBase
{
public Service1()
{

[Code]....

View 7 Replies View Related

C++ :: Execute Command In Command Prompt From Specific Path

Feb 15, 2013

I am facing a problem in C++,I want to execute a command in Command prompt from a specific path.I am able o select a path and execute cmd.exe using the function ShellExecute but the problem is after selecting the path I am not able to execute the command, the command is appearing on another command prompt.

View 4 Replies View Related

C/C++ :: Pass Path In File Handling To Create Or Open A File?

Jul 14, 2012

I have a folder "pics" in g: drive. There I want to create some text.txt file. Thus, the final path is "g:pics ext.txt".

How can I do that?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved