Discussion:
Lab 3
(too old to reply)
h***@cis.ohio-state.edu
2005-05-24 03:20:36 UTC
Permalink
I was confused on how the address is to be inputed by the user....In the Lab
3 handout, it says that we are supposed to use getchar to bring in
characters, one at a time, from the user......So if the user wants to input
the address 1A, we would implement the following in the hex_in subroutine?

getchar
1
getchar
A

or would we do this.........

getchar
1A

I understand the second technique i mentioned, but am confused if we are
someone supposed to use the first technique
matthew burton umland
2005-05-24 18:27:25 UTC
Permalink
I am confused about that as well. If you use a getchar in a loop then
the program will stop everytime it reaches the getchar, correct? So if
you put the getchar at the beginning of the loop and then process each
character one at a time the program will stop at each getchar then
process the character then stop and wait for another character. My
theory is that if the user inputs an entire string into the buffer then
getchar will just pull the next character from the input buffer one at a
time. I'm not sure if that will work but that's what I'm trying.

Matt
Post by h***@cis.ohio-state.edu
I was confused on how the address is to be inputed by the user....In the Lab
3 handout, it says that we are supposed to use getchar to bring in
characters, one at a time, from the user......So if the user wants to input
the address 1A, we would implement the following in the hex_in subroutine?
getchar
1
getchar
A
or would we do this.........
getchar
1A
I understand the second technique i mentioned, but am confused if we are
someone supposed to use the first technique
h***@cis.ohio-state.edu
2005-05-25 17:47:30 UTC
Permalink
Has anyone gotten the hex_in to work yet....I am still completely confused
on how we are supposed to make use of the getchar operation......
I am confused about that as well. If you use a getchar in a loop then the
program will stop everytime it reaches the getchar, correct? So if you put
the getchar at the beginning of the loop and then process each character
one at a time the program will stop at each getchar then process the
character then stop and wait for another character. My theory is that if
the user inputs an entire string into the buffer then getchar will just
pull the next character from the input buffer one at a time. I'm not sure
if that will work but that's what I'm trying.
Matt
Post by h***@cis.ohio-state.edu
I was confused on how the address is to be inputed by the user....In the
Lab 3 handout, it says that we are supposed to use getchar to bring in
characters, one at a time, from the user......So if the user wants to
input the address 1A, we would implement the following in the hex_in
subroutine?
getchar
1
getchar
A
or would we do this.........
getchar
1A
I understand the second technique i mentioned, but am confused if we are
someone supposed to use the first technique
Loading...