Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

File Handling

Using C language, how do I find a particular character in a file and then replace that line where the character was with my own comments and print the result to a new file??? I already opened the file for read and one for write. Thanks a lot.

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    : Using C language, how do I find a particular character in a file and then replace that line where the character was with my own comments and print the result to a new file??? I already opened the file for read and one for write. Thanks a lot.
    :
    Here are some hints: its up to you to write the actual program.
    [code]
    for each line in the file
    read one line into a character buffer
    search the line for the desired character (hint: strchr())
    if the character is found, write out our own comments to the out file
    otherwise if the character was NOT found write the entire
    lint to the out file.
    end of loop
    close both files
    [/code]
Sign In or Register to comment.