You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by fantasy1215 <al...@163.com> on 2010/06/19 02:47:54 UTC

Calling svn.exe from C++ code!

For some reason, I need to call svn.exe in my code, following is just a test
hard written code,
What am I doing is just 'svn diff'.
but it doesn't work. Not touch a c:\abc123.txt file.
Thanks in advance!
	TCHAR szExePath[] = TEXT("C:\\Program Files\\Subversion\\bin\\svn.exe");
	SHELLEXECUTEINFO shinfo = {0};
	shinfo.cbSize = sizeof(SHELLEXECUTEINFO);
	shinfo.fMask = SEE_MASK_NO_CONSOLE;
	shinfo.hwnd = NULL;
	shinfo.lpVerb = TEXT("open");
	shinfo.lpFile = szExePath;
	shinfo.lpParameters = TEXT(" diff -r 755:HEAD E:\\workcopy\\Main.cpp >
c:\\abc123.txt");
	shinfo.lpDirectory = NULL;
	shinfo.nShow = SW_SHOW;
	shinfo.hInstApp = NULL;
	BOOL bRet = FALSE;
	bRet = ::ShellExecuteEx(&shinfo);    --------->here return value is TRUE,
and I saw console flash
-- 
View this message in context: http://old.nabble.com/Calling-svn.exe-from-C%2B%2B-code%21-tp28932381p28932381.html
Sent from the Subversion Users mailing list archive at Nabble.com.

Re: Calling svn.exe from C++ code!

Posted by Dongsheng Song <do...@gmail.com>.
shinfo.lpParameters should only be parameters, not include redirecting
standard output to a file.下载
MP3<http://www.engkoo.com/a/C0D1DE8CE713BF18CB9201401F271F71.mp3>

You should use CreateProcess, read differences output from
lpStartupInfo.hStdOutput.

On Sat, Jun 19, 2010 at 10:47, fantasy1215 <al...@163.com> wrote:

>
> For some reason, I need to call svn.exe in my code, following is just a
> test
> hard written code,
> What am I doing is just 'svn diff'.
> but it doesn't work. Not touch a c:\abc123.txt file.
> Thanks in advance!
>        TCHAR szExePath[] = TEXT("C:\\Program
> Files\\Subversion\\bin\\svn.exe");
>        SHELLEXECUTEINFO shinfo = {0};
>        shinfo.cbSize = sizeof(SHELLEXECUTEINFO);
>        shinfo.fMask = SEE_MASK_NO_CONSOLE;
>        shinfo.hwnd = NULL;
>        shinfo.lpVerb = TEXT("open");
>        shinfo.lpFile = szExePath;
>        shinfo.lpParameters = TEXT(" diff -r 755:HEAD E:\\workcopy\\Main.cpp
> >
> c:\\abc123.txt");
>        shinfo.lpDirectory = NULL;
>        shinfo.nShow = SW_SHOW;
>        shinfo.hInstApp = NULL;
>        BOOL bRet = FALSE;
>        bRet = ::ShellExecuteEx(&shinfo);    --------->here return value is
> TRUE,
> and I saw console flash
> --
> View this message in context:
> http://old.nabble.com/Calling-svn.exe-from-C%2B%2B-code%21-tp28932381p28932381.html
> Sent from the Subversion Users mailing list archive at Nabble.com.
>
>