DOS Help for Beginner

Hi Guys,

I hope you can help, I have a file and within that file I have about 20 odd lines of information, what I basically want to do is copy the first bit of information and ouput it to another text file so for e.g.

\blahlahlah.pj ->
\blah.pj ->
\blahlahlahlahlah.pj ->
\blah.pj ->

I want all the info from \ to -> ouputted to another file.

Thanks in advance for your help


  • [color=Blue]
    1. Open the source file with fopen()
    2. Create the target file with fopen()

    3. Read source line with fgets()
    4. Find the marker where you need to truncate the line (strchr() or strstr())
    5. Truncate the line by storing zero AFTER the marker you have found
    6. Append '
    ' character to the line with strcat()
    7. Write the truncated line to target file with fputs()

    8. Repeat all steps starting from step #3 until there are no more lines left in source file.

    9. Close both files with fclose()
Sign In or Register to comment.

Howdy, Stranger!

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


In this Discussion