Article View: borland.public.cppbuilder.nativeapi
Article #14918Re: system CDM
From: Stephane Baillargeon
Date: Sun, 27 Jul 2003 00:49
Date: Sun, 27 Jul 2003 00:49
109 lines
4126 bytes
4126 bytes
Thanks anyways ed, but this didn't help. I'm making a tool to copy files
from a local PC to the Xbox debug kit (XDK). Yes... I'm a game developer...
8P
e.g.: xbcp -x -r -s -f c:\whatever\*.* xe:\0.4.3.2\ApprenticeKnight\
I have about 15 of these commands to execute.
I resolved the problem temporarly by creating a batch file and then
executing it with system or ShellExecute ....
"Ed Mulroy [TeamB]" <ed@mulroyREMOVETHESECHARS.org> wrote in message
news:3f218ac9@newsgroups.borland.com...
> Nothing you show needs a call to the function system. All of them can
> easily be done in your program. You do a directory with FindFirstFile,
> FindNextFile and FindClose and writing the results to the screen. You do
a
> pause by writing a prompt and waiting for a key to be pressed. Look in
the
> Windows help file for docs on those functions, win32.hlp
>
> For an example of what I am saying, build this as a console mode program
and
> run it:
>
> ----------------------------
> #include <windows.h>
> #include <stdio.h>
> #include <conio.h>
>
> void DoDir()
> {
> WIN32_FIND_DATA wfd;
> HANDLE find_handle;
>
> find_handle = FindFirstFile("*.*", &wfd);
>
> if (find_handle != INVALID_HANDLE_VALUE)
> {
> char current_dir[MAX_PATH + 1];
> int num_files = 0;
> int num_dirs = 0;
> unsigned long size_sum = 0;
>
> GetCurrentDirectory(sizeof(current_dir), current_dir);
> printf("Directory of %s\n\n", current_dir);
>
> do
> {
> FILETIME ft;
> SYSTEMTIME st;
>
> FileTimeToLocalFileTime(&wfd.ftLastWriteTime, &ft);
> FileTimeToSystemTime(&ft, &st);
>
> printf("%02u/%02u/%04u %02u:%02u %s ",
> st.wMonth, st.wDay, st.wYear,
> st.wHour % 12, st.wMinute,
> (st.wHour >= 12) ? "PM" : "AM");
>
> char *filename = wfd.cFileName;
>
> if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
> {
> ++num_dirs;
> printf("%-15s%s\n", "<DIR>", filename);
> }
> else
> {
> ++num_files;
> size_sum += wfd.nFileSizeLow;
> printf("%6s%8u %s\n", " ", wfd.nFileSizeLow, filename);
> }
> } while (FindNextFile(find_handle, &wfd));
>
> FindClose(find_handle);
> printf("%16d File(s) %13u bytes\n", num_files, size_sum);
> printf("%16d Dir(s)\n", num_dirs);
> }
> }
>
> void DoPause()
> {
> printf("Press any key to continue . . . ");
>
> if (!getch())
> getch();
> }
>
> int main()
> {
> DoDir();
> DoPause();
> return 0;
> }
> ----------------------------
>
> . Ed
>
> > Stephane Baillargeon wrote in message
> > news:3f216b4f$1@newsgroups.borland.com...
> > How can I execute multiple commands in one and only
> > one cmd window without using a batch file. Is it possible?
> >
> > example:
> > system ( "dir" );
> > system ( "pause" );
>
>
Technical Details
Message-ID:
<3f23216d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f216b4f$1@newsgroups.borland.com> <3f218ac9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,aec67fd76b7834fc X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-26 17:52:57 PST From: "Stephane Baillargeon" <sbaillargeon@microids.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f216b4f$1@newsgroups.borland.com> <3f218ac9@newsgroups.borland.com> Subject: Re: system CDM Date: Sat, 26 Jul 2003 20:49:16 -0400 Lines: 111 Organization: Microids Canada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 65.94.233.40 Message-ID: <3f23216d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1059266925 65.94.233.40 (26 Jul 2003 17:48:45 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail