Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursive fonction to converse character

Status
Not open for further replies.

Exode

Programmer
Feb 17, 2004
14
CA
Hi all, I'm starting to learn the C language and having a hard time finding help for what I'm doing.

My program handle books' informations. I have a struct containing different fields for each information (title, autor, subject, etc).

I need to create a recursive fonction that goes through a file, read every struct and for each autor, changes the name to lowercase except for the first letter, which should be converted to uppercase.

Any help or indication woudl be highly appreciated. Thanks all for your time.

Frank
 
Any reason this *must* be recursive? An iterative solution would do a good job, and be simple to understand. Just read data in alter it, the write it back out (to a new file maybe).
 
Hmm.
function proto=readRecord(FILE *, struct record *);

1. Use fgets() and sscanf() or fscanf() to read
the required info into your linked list at record.
Handle errors. You may need to check for a valid
start sequence in file before committing data to
your structure.

2. Think of the recursion as repetitive reading
of one record and committing to a new list element
with the file pointer advancing till eof.

Thats it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top