C code for a project that read a dat file and sorts the info

The data you will use is a list of taxonomy information provided by The Society for the Study of Amphibians and Reptiles (SSAR) specifically the species found in North America ([url removed, login to view]). This data has been simplified and formatted as a .dat file. The first value is the number of records in the dataset. The next set of entries are the titles of each field. Each record contains the Genus, Species, Subspecies, Type, and Common Name of an amphibian or reptile. You will be provided code that reads and stores this data in an array of Structs.

Your program will repeatedly ask the user if they would like to do one of the following actions:

List the common name of all frogs.

List the common name of all lizards.

List the common name of all turtles.

List the common name of all snakes.

List the common name of all crocodilians.

List the common name of all salamanders.

Enter a targeted mode which allows the user to input a common name and the program then identifies its full Genus, Species, and Subspecies.

Or exit the program.

To read an entire string, including spaces, from the keyboard use scanf(" %[^\n]s",nameInput);

started program is below

#include <stdio.h>

#include <stdlib.h>

//put function headers here

int main(){

FILE *herp = fopen("[url removed, login to view]", "r");

if(herp == NULL){

printf("Cannot find dataset.\nSave in the same place as the program.\n");

return 1;


int numRecords;


char **genus = (char **)calloc(numRecords, sizeof(char*));

char **species = (char **)calloc(numRecords, sizeof(char*));

char **sub = (char **)calloc(numRecords, sizeof(char*));

char **common = (char **)calloc(numRecords, sizeof(char*));

char **type = (char **)calloc(numRecords, sizeof(char*));

int i;

for(i = 0; i < numRecords; i++){

genus[i] = (char *) calloc(25, sizeof(char));

species[i] = (char *) calloc(25, sizeof(char));

sub[i] = (char *) calloc(25, sizeof(char));

type[i] = (char *) calloc(25, sizeof(char));

common[i] = (char *) calloc(100, sizeof(char));


//read the titles

char ignore[40];


//read the data

for(i = 0; i < numRecords; i++)

fscanf(herp, "%s%s%s%s %[^\n]s", genus[i],species[i],sub[i],type[i],common[i]);


//add your code here

//for debugging purposes

//for(i = 0; i < numRecords; i++)

// printf("%s,%s,%s,%s,%s\n", genus[i],species[i],sub[i],type[i],common[i]);

//do not remove the following lines of code

for(i = 0; i < numRecords; i++){












return 0;


//add functions here

Evner: C programmering

Se mere: read integer from file in c, file handling in c programming, c program to read and write to a file, c program to write data into a file, c program to read a file line by line, c program to read a text file and store in an array, reading integers from a file in c into array, how to read integers from a file line by line in c, code project import flat file data sql, code linux read image file, example code will read ipd file, flat file code project, code project edit pdf file, code project mvc upload file ajax, read dat file servlet, code visual read file wav, project read file excel java, code project store video audio file database play audio player asp net, project read text file, code project read page parse webpage

Om arbejdsgiveren:
( 1 bedømmelse ) El paso, United States

Projekt ID: #15800880

Tildelt til:

$30 USD på 1 dag
(29 bedømmelser)

3 freelancere byder i gennemsnit $28 på dette job

$30 USD på 1 dag
(60 bedømmelser)

I work in c for my Daily job, so it would be easy for me Relevant Skills and Experience C, c++, Java, embedded c

$25 USD in 2 dage
(0 bedømmelser)