Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about how to call an .exe file from C#

0 views
Skip to first unread message

alex boulet

unread,
Aug 4, 2002, 6:49:03 PM8/4/02
to
Hello,
I am really new to programming in general but I have this project
where I need to use C# and I can't figure out something.
The way it works, I need to run an executable file and take a text
file as input.
According to the documentation , from DOS, I would simply have to type
the following:
C:/program_name.exe C:/program_command.txt
This is pretty much the same way in Matlab by the way.
Does anyone know how to do this in C#?
I would really appreciate any help as I struggled the last few days
and it does not seem like something that should be very difficult to
figure out.
Thanks!
Alex.

Mark McIntyre

unread,
Aug 4, 2002, 6:53:43 PM8/4/02
to
On 4 Aug 2002 15:49:03 -0700, in comp.lang.c ,
Alex....@IntelliChem.com (alex boulet) wrote:

>Hello,
>I am really new to programming in general but I have this project
>where I need to use C# and I can't figure out something.

Wrong newsgroup.

>The way it works, I need to run an executable file and take a text
>file as input.
>According to the documentation , from DOS, I would simply have to type
>the following:
>C:/program_name.exe C:/program_command.txt
>This is pretty much the same way in Matlab by the way.
>Does anyone know how to do this in C#?

No. If you were asking about C, I'd say system();


--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>

Gordon Burditt

unread,
Aug 4, 2002, 9:11:26 PM8/4/02
to
>I am really new to programming in general but I have this project
>where I need to use C# and I can't figure out something.
>The way it works, I need to run an executable file and take a text
>file as input.

The *ONLY* way in portable ANSI C to run another program
is system(). And the strings you pass it are system-dependent.

This newsgroup and the above comment apply to C. It may or may not
apply to C#, whatever that is, but my guess is that you don't have
a license to ask questions about this to anyone but Microsoft (nor
does anyone else).

>According to the documentation , from DOS, I would simply have to type
>the following:
>C:/program_name.exe C:/program_command.txt
>This is pretty much the same way in Matlab by the way.
>Does anyone know how to do this in C#?
>I would really appreciate any help as I struggled the last few days
>and it does not seem like something that should be very difficult to
>figure out.

Gordon L. Burditt

Emmanuel Delahaye

unread,
Aug 5, 2002, 1:26:48 AM8/5/02
to
In 'comp.lang.c', Alex....@IntelliChem.com (alex boulet) wrote in
news:f5cc096.02080...@posting.google.com:

> I am really new to programming in general but I have this project
> where I need to use C# and I can't figure out something.

<...>

What the heck is C#? This is a C group.

Try

news:microsoft.public.dotnet.languages.csharp

(Personnal advice : drop C#, stick to C, C++ and Java)

--
-ed- emdel at noos.fr
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
C-library: http://www.dinkumware.com/htm_cl/index.html
"Mal nommer les choses c'est ajouter du malheur au monde."
Albert Camus.

Robert Stankowic

unread,
Aug 5, 2002, 9:16:32 AM8/5/02
to

"Emmanuel Delahaye" <emdel...@noos.fr> schrieb im Newsbeitrag
news:Xns92614BBFCFF...@130.133.1.4...

> In 'comp.lang.c', Alex....@IntelliChem.com (alex boulet) wrote in
> news:f5cc096.02080...@posting.google.com:
>
> > I am really new to programming in general but I have this project
> > where I need to use C# and I can't figure out something.
> <...>
>
> What the heck is C#? This is a C group.
>

##include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
printf("C# is roughly between %f and %f Hertz\n",
435.0 * pow(2.0, 1.0 / 3.0),
445.0 * pow(2.0, 1.0 / 3.0));
return EXIT_SUCCESS;
}

Robert, supposing there is a "C" answer for more things between heaven and
earth than man can imagine :-)


Richard Heathfield

unread,
Aug 5, 2002, 3:23:31 PM8/5/02
to

I think you're a little sharp. Your estimates (halved to bring them
closer to middle C) work out as

274.03282835213491333686830708301

and

280.33243360160927916070436011941


I make C# closer to

271.22255215597958772782727550626

which I derive from 256.0 * pow(2.0, 1.0/12.0)

Perhaps we should take this up in rec.music or whatever. :-)


--
Richard Heathfield : bin...@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton

Jens.T...@physik.fu-berlin.de

unread,
Aug 5, 2002, 6:34:51 PM8/5/02
to

In what system kind of system is C# a half-tone above 256 Hz? It looks
like you have been dealing with binary numbers for too long ;-) What I
would mind about Robert Stankowic's answer is that he assumes that
everyone is tuning his instrument to about A = 440 Hz, which a lot
people don't do.I for one often use a 415 Hz tuning fork (with C# being
261.433618 Hz) - but when you play with people with a keyboard instrument
you have to use what they have anyway ;-) And, of course, these formulas
only work when you use this horrible "well-tempered" (as it is nowadays
falsely called) system of tuning ...
Regards, Jens
--
_ _____ _____
| ||_ _||_ _| Jens.T...@physik.fu-berlin.de
_ | | | | | | AG Moebius, Institut fuer Molekuelphysik
| |_| | | | | | Fachbereich Physik, Freie Universitaet Berlin
\___/ens|_|homs|_|oerring Tel: ++49 (0)30 838 - 53394 / FAX: - 56046

Kevin Goodsell

unread,
Aug 5, 2002, 7:57:12 PM8/5/02
to
On Mon, 05 Aug 2002 20:23:31 +0100, Richard Heathfield
<bin...@eton.powernet.co.uk> wrote:

>Robert Stankowic wrote:
>>
>>
>> ##include <stdio.h>
>> #include <stdlib.h>
>> #include <math.h>
>>
>> int main(void)
>> {
>> printf("C# is roughly between %f and %f Hertz\n",
>> 435.0 * pow(2.0, 1.0 / 3.0),
>> 445.0 * pow(2.0, 1.0 / 3.0));
>> return EXIT_SUCCESS;
>> }
>>
>> Robert, supposing there is a "C" answer for more things between heaven and
>> earth than man can imagine :-)
>
>I think you're a little sharp. Your estimates (halved to bring them
>closer to middle C) work out as
>
> 274.03282835213491333686830708301
>
>and
>
> 280.33243360160927916070436011941
>
>
> I make C# closer to
>
> 271.22255215597958772782727550626
>
>which I derive from 256.0 * pow(2.0, 1.0/12.0)
>
>Perhaps we should take this up in rec.music or whatever. :-)

The following is utterly OT, and maybe utterly wrong:

A above middle C is usually taken to be 440 Hz. To get from one note
to the next in the scale, one would multiply the frequency by the 12th
root of 2. C# is 4 notes past A, so the frequency would be about

440*pow(pow(2.0, 1.0/12.0), 4)

Which is about 554.365 Hz. Of course, this isn't the *only* C#. The
one you are looking for is half the frequency (one octave lower), at
about 277.183 Hz.

-Kevin

Emmanuel Delahaye

unread,
Aug 5, 2002, 8:08:17 PM8/5/02
to
In 'comp.lang.c', Kevin Goodsell <good...@bridgernet.com> wrote in
news:6i3ukuc26pptlt07p...@4ax.com:

> The following is utterly OT, and maybe utterly wrong:
>
> A above middle C is usually taken to be 440 Hz. To get from one note

bzzt... middle A (A3) is 440 Hz.

Emmanuel Delahaye

unread,
Aug 5, 2002, 8:09:19 PM8/5/02
to
In 'comp.lang.c', Emmanuel Delahaye <emdel...@noos.fr> wrote in
news:Xns926215C0355...@130.133.1.4:

> bzzt... middle A (A3) is 440 Hz.

A4 actually...

Kevin Goodsell

unread,
Aug 5, 2002, 8:39:52 PM8/5/02
to
On 6 Aug 2002 00:09:19 GMT, Emmanuel Delahaye <emdel...@noos.fr>
wrote:

>In 'comp.lang.c', Emmanuel Delahaye <emdel...@noos.fr> wrote in
>news:Xns926215C0355...@130.133.1.4:
>
>> bzzt... middle A (A3) is 440 Hz.
>
>A4 actually...

I searched for the terms (middle c frequency) on Google and the first
two documents returned caught my eye. The first contained this quote:

"A440 is the musical note A above middle C."

The second contained this quote:

"If the piano is properly tuned, middle C has a frequency of 256
cycles per second..."

Both of these back up my claim somewhat, but they are inconsistent
with each other. The second explains why Mr. Heathfield was using 256
(which a few of us apparently thought strange).

I suppose it's safe to say that there is more than one standard for
musical pitch.

-Kevin

0 new messages