subject

Program in C. Use the skeleton code below. Fill the structure with all four values: views, user, times, titles#include #include #include #define LINE_LENGTH 100struct clip *build_a_lst();struct clip *append();int find_length();void print_lst();void split_line();struct clip { int views; char *user; char *id; char *title; struct clip *next;} *head;int main(int argc, char **argv) { int n; head = build_a_lst(*(argv+1)); n = find_length(head); printf("%d clips\n",n); print_lst(head); /* prints the table */ return 0;}struct clip *build_a_lst(char *fn) { FILE *fp; struct clip *hp; char *fields[4]; char line[LINE_LENGTH]; int cnt=0; hp=NULL; // open fn // while no more lines // read a line // split the line into four substrings/int and store them in a struct // append - add the struct at the end of the list // return the head pointer holding the list return hp;}/* fields will have four values stored upon return */void split_line(char **fields, char *line) { int i=0; char *token, *delim; delim = ",\n"; /* call strtok(line, delim); repeat until strtok returns NULL using strtok(NULL, delim); */}/* set four values into a clip, insert a clip at the of the list */struct clip *append(struct clip *hp, char **five) { struct clip *cp,*tp; /* malloc tp set views using atoi(*five) malloc for four strings. strcpy four strings to tp insert tp at the end of the list pointed by hp use cp to traverse the list */ return hp;}void print_a_lst(struct clip *cp) { /* use a while loop and the statement below to print the list printf("%d,%s,%s,%s,%s\n",cp->vi ews, cp->user, cp->id, cp->title, cp->time); */}/* end */Prepare a CSV file (comma sepearated value file) containing all the values. Each line of the CSV file will consist of views, user, id, titles. Use the same commands you used to create a table, except now that you have to put in "," (commas) in between the four values as delimiter. Note however that before you put in commas, you need to convert those pre-existing commas (some titles have commas unfortunately) to something else such as MY_COMMA or something of that sort. Later on you can revert MY_COMMA back to real commas when everything is said and done. Use strtok() function to split a line into four fields with "," as the delimiter. As cautioned above, you need to convert commas to something else which can then be reverted back to commas after you have built a list. insert_at_end(char *s) will insert not just user but all the remaining values as well.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:50
3.2.5 suppose that we have an estimate ahead of time of how often search keys are to be accessed in a bst, and the freedom to insert items in any order that we desire. should the keys be inserted into the tree in increasing order, decreasing order of likely frequency of access, or some other order? explain your answer.
Answers: 1
question
Computers and Technology, 22.06.2019 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 23.06.2019 10:30
Would a ps4 wired controller work on an xbox one
Answers: 1
question
Computers and Technology, 23.06.2019 12:30
What is the difference between the internet and the world wide web?
Answers: 1
You know the right answer?
Program in C. Use the skeleton code below. Fill the structure with all four values: views, user, tim...
Questions
Questions on the website: 13722359