On Fri, 2013-05-17, Malcolm McLean wrote:
> On Thursday, May 16, 2013 9:50:22 PM UTC+1, Eric Walz wrote:
>>
>>
>> Can anyone give me some insights on this programming problem for a project?
An exercise, surely.
>> Have a program prompt the user for a filename to open. Change every
>> alphabetic character in the file to a capital letter. Numbers and special
>> characters should not be changed. Print the output to the screen.
>>
>> I am new to learning C and could use some help. Thank you.
>>
> Break the problem down.
>
> First create a test file with some data in it. Remember to save as
> a pure ASCII plain text file.
And remember that you have now narrowed down the instructor's rather
vague instructions to ASCII text files.
> Then see if you can fopen() and fclose() it.
Or skip that part for now and read from stdin, write to stdout.
I don't quite understand why exercises like these always want you to
"prompt the user". In real non-GUI programs you try to avoid that
since it prevents automation, doesn't allow for filename completion
etc.
> Then read the first character, echo it to the screen, and check it is right.
> Then write a loop so you are echoing the whole file to the screen.
> Then get the processing working.
> Then replace your hardcoded filename with one obtained from the
> user. (This is actually the hardest step to do robustly, but easy
> if you limit the path to say 1024 characters).
Yes.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/
snipabacken.se> O o .