I need a general idea how to attack this problem.

C

Chad

say I have an ascii art input file like

______
< gnu? >
------
\ , ,
\ /( )`
\ \ \___ / |
/- _ `-/ '
(/\/ \ \ /\
/ / | ` \
O O ) / |
`-^--'`< '
(_.) _ ) /
`.___/` /
`-----' /
<----. __ / __ \
<----|====O)))==) \) /====
<----' `--' `.__,' \
| |
\ /
______( (_ / \______
,' ,-----' | \
`--{__________) \/


What I want to do is read this fle into, and have it printed to the
standard output. I thought about maybe using fgets() to read each line
in at a time. I then would store this line in an array. After I read
each, and stored each line in an array, I would just print the array.
Is this a sane approach?

Chad
 
P

Phlip

Chad said:
say I have an ascii art input file like

______
< gnu? >

Try it with a simpler input file first:

#\ # #
#\ # # ^^^^^
#\ # # }OvO{
## # {| |}
# # \| |/
# # \ /
# # | |
# #>=====d=b====
# #
 
J

Jon Harrop

Chad said:
say I have an ascii art input file like

______
< gnu? >
------
\ , ,
\ /( )`
\ \ \___ / |
/- _ `-/ '
(/\/ \ \ /\
/ / | ` \
O O ) / |
`-^--'`< '
(_.) _ ) /
`.___/` /
`-----' /
<----. __ / __ \
<----|====O)))==) \) /====
<----' `--' `.__,' \
| |
\ /
______( (_ / \______
,' ,-----' | \
`--{__________) \/


What I want to do is read this fle into, and have it printed to the
standard output. I thought about maybe using fgets() to read each line
in at a time. I then would store this line in an array. After I read
each, and stored each line in an array, I would just print the array.
Is this a sane approach?

Nice art. :)

You could avoid storing the file explicitly in an array and just print it
out as you read it:

while !stdin.eof() {
print(input stdin)
}
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top