file – FileParsing and Sorting in C

So I have a text file filled with old onion links and its incredibly messy:

1   Dark web Link– Deep Web Links – Hidden Wiki     http://dwlonion3o3pjqsl.onion/  online
2   Darkode Reborn  http://darkodevasbv5yof.onion   online
3   Arm’s Factory   http://gunsfact2f6oz7cw.onion/  online
4   Dark Web Hackers Zone   http://darkzonebry27nxa.onion/  online
5   Raptor (Tor Chat Service)   http://raptortiabg7uyez.onion   online

*Each line looks like: (int)t(name) (url) (status)
Since my C code tends to be pretty bad I wanted to improve it. I wrote a simple file parser which attempts to only take into account the url and status and would like to know if there are any ways of optimizing my code/improving the sort function since that’s where I feel weakest:

#include <stdio.h>
#include <stdlib.h>
#include "sorter.h"

#define onionLinksFile "onionlinks.txt"
#define output "sorted\output.txt" //folder for output

int main() {

    FILE *file = fopen(onionLinksFile, "r");
    FILE *nFile = fopen(output, "w+");
    char line(256); //allocate up to 256 chars for each line
    if (file == NULL){
        printf("> An error occured while attempting to open our file...");
        return 1;

    while (fgets(line, sizeof(line), file)) { //get each newline
        fprintf(nFile, sort(line)); //write our sorted data to our text file

    return 0;


#include <stdio.h>
#include <string.h>

#define delimter "t" //our delimters
#define mDelimter "//"

char *sort(char line(256)) {
    int objCount = 0;
    int mObjCount = 0;
    char *token = strtok(line, delimter);
    while (token != NULL){ //attempt to split our string by tabs

        if (objCount > 1){ //ignore the first number, don't care about that
            char *nToken = strtok(token, mDelimter);

            while (nToken != NULL){ //split the string again this time take everything past the //
                if (mObjCount > 1){
                    return nToken;
                nToken = strtok(NULL, "");

        token = strtok(NULL, "");

And here is how the output looks:

/dwlonion3o3pjqsl.onion/    online
/darkodevasbv5yof.onion     online
/gunsfact2f6oz7cw.onion/    online
/darkzonebry27nxa.onion/    online
/raptortiabg7uyez.onion     online
/gurochanocizhuhg.onion/    offline
/6a3nny6zpg23dj7g.onion/    offline