Read the file and sort by name in an alphabetical order in linked list

How can I read the file and sort by name alphabetically while in a linked list?

ifstream fin("inventory.txt"); // provide full path to file

// check if file can be opened
if (fin.is_open())
{
// read till the end of file, inserting items into the inventory

while (!fin.eof())
{
fin >> item.name >> item.price >> item.pixels >> item.stocks;
inventory.insert(item, 0); // inventory the item at first position
inventory.ascendingOrder();
}

fin.close(); // close the file
}

Inventory.txt

Telephoto-Pocket-Camera 54.95 15 20
Mini-Pocket-Camera 24.95 15 12
Polaroid-1Step-Camera 49.95 10 20
Sonar-1Step-Camera 189.95 12 13
Pronto-Camera 74.95 5 15
8MM-Zoom-Movie-Camera 279.99 10 9
8MM-Sound/ZoomMovieCamera 310.55 10 15
35MM-Minolta-SLR-XG-7-Camera 389.00 12 10
35MM-Pentax-SLR-AE-1-Camera 349.95 12 11
35MM-Canon-SLR-ME-Camera 319.90 12 20
35MM-Hi-Matic-Camera 119.95 12 13
35MM-Compact-Camera 89.99 12 20
Zoom-Movie-Projector 129.95 5 7
Zoom-Sound-Projector 239.99 5 9
Auto-Carousel-Projector 219.99 5 10
Carousel-Slide-Projector 114.95 5 4
Pocket-Strobe 14.95 5 4
StrobeSX-10 48.55 10 12
Electonic-Flash-SX-10 28.99 15 10
Tele-Converter 32.99 15 13
28MM-Wide-Angle-Lens 97.99 15 14
135MM-Telephoto-Lens 87.95 15 13
35-105MM-Zoom-Lens 267.95 5 8
80-200MM-Zoom-Lens 257.95 5 7
Heavy-Duty-Tripod 67.50 5 4
Lightweight-Tripod 19.95 5 10
35MM-Enlarger-Kit 159.99 5 10
40x40-Deluxe-Screen 35.98 5 4
50x50-Deluxe-Screen 44.98 5 10
120-Slide-Tray 4.29 25 17
100-Slide-Tray 2.95 25 33
Slide-Viewer 6.25 15 12
Movie-Editor 55.95 10 12
Condenser-Microphone 59.95 5 10
AA-Alkaline-Battery 0.89 100 80
Gadget-Bag 19.79 20 19
135-24-Color-Film 1.49 50 45
110-12-Color-Film 0.99 50 60
110-24-Color-Film 1.45 50 42
110-12-B/W-Film 0.59 25 37
110-24-B/W-Film 0.95 25 43
126-12-Color-Film 0.89 50 44
126-12-B/W-Film 0.59 25 27
8MM-Film-Cassette 6.89 50 39
16MM-Film-Cassette 11.89 20 25
Combination-Camera-Kit 959.99 12 10
Topic archived. No new replies allowed.