running c program

S

skyguy2002

I have wriiten a C program that complies and builds perfectly without
errors.
The purpose of the program is to count the number of times that the
letter a occurs in a file.
My only problem is in running the program.
What command should I give(using microsoft visual C)to get a reading
of the number of a's in the file: 'test.c' say?
 
J

Joona I Palaste

skyguy2002 said:
I have wriiten a C program that complies and builds perfectly without
errors.
The purpose of the program is to count the number of times that the
letter a occurs in a file.
My only problem is in running the program.
What command should I give(using microsoft visual C)to get a reading
of the number of a's in the file: 'test.c' say?

It depends entirely on how your program works. Are we supposed to read
your mind to see how you have written the code? I'll take a shot in the
dark anyway. If you're reading from stdin, try:
C:\> test <test.c
If your program instead opens a file supplied as a command-line
argument and reads fro it, try:
C:\> test test.c
If your program opens test.c in another way, use it instead. If your
program can't open test.c at all, you're stuck.
The point is: show your code. We're not psychic.
 
C

CBFalconer

Sidney said:
[...] We're not psychic.

I had this eery premonition that someone was going to answer
along these lines ...

Well, I am. After compiling, push the third button from the left
and spit on the keyboard. (I didn't say I was a good psychic).
 
M

Mike Wahler

skyguy2002 said:
I have wriiten a C program that complies and builds perfectly without
errors.
The purpose of the program is to count the number of times that the
letter a occurs in a file.
My only problem is in running the program.
What command should I give(using microsoft visual C)to get a reading
of the number of a's in the file: 'test.c' say?

Say clearly in a loud voice: "Computer! How many 'a' characters
are in my file?" Then listen carefully for the reply.


Alternatively, delete the file. Then the answer to the question
is: zero.

-Mike
 
G

Gordon Burditt

I have wriiten a C program that complies and builds perfectly without

This is a warning sign that the program has bugs.
The purpose of the program is to count the number of times that the
letter a occurs in a file.
My only problem is in running the program.

Hint: don't use the name of a program that already exists
on your system. 'test' already exists on a number of platforms,
UNIX variants especially.
What command should I give(using microsoft visual C)to get a reading
of the number of a's in the file: 'test.c' say?

Microsoft has commands? As distinguished from furious rodent-clicking?

You wrote this homework problem, right? Where did you write it to
get its input from? Do you give the name of the file as a command-line
argument? If so, invoke the command with the name of the file as a
command-line argument.

Gordon L. Burditt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,138
Messages
2,570,804
Members
47,349
Latest member
jojonoy597

Latest Threads

Top