| | |
sorting file
![]() |
hello,
i want to sort a file and i don't know how to put the data from a certain field of the file in a vector, sort it and then put it back in the file.
here's what i've done.
i'd appreciate any help with this sorting algorithm or another that would be simpler.thank you.
i want to sort a file and i don't know how to put the data from a certain field of the file in a vector, sort it and then put it back in the file.
here's what i've done.
C Syntax (Toggle Plain Text)
FILE *file; struct catalog{char 1rst_field,2nd_field,3rd_field}name,v[100]; //here i put the data in the file typedef int(*fcmp)(const void*,const void*) cmp1rst_field(catalog a1,catalog a2) {return a1.1rst_field-a2.1rst_field} int a[100],n=100,i; void sort() { while(!feof(file)) //here i'd have to put the data from 1rst_field in a[i];i++; qsort(&a[0],n,sizeof (int),(fcmp)cmp1rst_field) }
![]() |
Similar Threads
Other Threads in the C Forum
- Previous Thread: C craps game
- Next Thread: Displaying Data in C programmming
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush fgets file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking highest homework i/o inches incrementoperators iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix meter microsoft mqqueue mysql number odf open openwebfoundation owf pattern pdf performance pointer posix power probleminc process program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socket socketprograming socketprogramming stack standard string suggestions systemcall test unix urboc user voidmain() wab win32api windows.h





