In main() I want to declare the two files I'll be working with as strings, char*source and char*dest. Eventually, I'll be reading one line at a time from the source and sending that string to a strtok function to get parsed and written to a structure, which I'll then write to my dest file. Before I do any of that though, I need to correct however I am incorrectly handling the files.
I apologize for the incompleteness of this, the primary thing I'm trying to do and test for. Is to send a string from main as the file name to the function, and have the function open the files by using the strings as arguments to fopen. Any help would be greatly appriciated.
Here's where I'm stuck at:
Code:
int main (int argc, char *argv[]){
    char *source = "ascii.txt";
    char *dest = "binary.bin";
    
    int num_read = 0;
    int num_skipped = 0;
    
    ZIPS_create_bin_from_ascii(source, dest, &num_read, &num_skipped);
    
    printf("num_read = %d\n", num_read); //test, show number of lines in file
    
    return 0;
}
int ZIPS_create_bin_from_ascii(char *ascii_file, char *binary_file,
                               int *recs_read, int *recs_skipped){
    FILE *sfp;
    FILE *dfp;
    char str[512];
    
    sfp = fopen(ascii_file, "rb");
    dfp = fopen(binary_file, "wb");
    
    if(sfp || dfp == NULL)
        exit(1);
    
    else{
        while(fgets(str, 511, sfp) != NULL){   //going wrong here
                ++recs_read;
        }
        fclose(dfp);
    }
    fclose(sfp);
    return 0;
}