Alphabetizing Lines of Text

This is a discussion on Alphabetizing Lines of Text within the C Programming forums, part of the General Programming Boards category; I am supposed to take the contents of 1 text document and output it into another by have the lines ...

However, I'm not sure what steps I should take next to begin alphabetizing each line. I will also have to make sure I read past the first character if both lines start with the same character. I can use strcpy, but I'm not sure how to implement it.

Use strcmp() to compare strings. It handles the comparison for you so bubblesort (or any other sorting algorithm) will work.

Alright, that's what I was expecting to do. How would I get each line of text into an area where I can use the bubblesort process on them? I know each character is being read, but I'm not sure how to recall all those characters and then refer to each line as a separate array of characters. For instance, if I were to make a bubblesort function, where would I call it, and what parameters would I bring up into the function.

Check for NULL after fopen, because it can fail! If it fails, your app will crash!
And secondly, since all those characters are sorted by line, I suggest you read the contents line-by-line into a 2D array like Salem suggests. Then you can sort them and print them back.