Computers and Technology
Computers and Technology, 30.06.2020 17:01, alyo31500

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:00, banna01man
You need a reliable network for about twenty-five computers that will be distributed across a large building. it is important that the network be relatively cheap. which topology should you use?
Answers: 1
image
Computers and Technology, 23.06.2019 03:00, minelly1717
Your business be in google top rank. more the rank more the business leads. for best seo and digital marketing services be confident to contact you can get best seo solutions by assistance experts provide digital marketing, website development, seo expert services and social media internet seo expert services your branding solutions. seo expert services ,best seo expert services, online seo expert services,
Answers: 3
image
Computers and Technology, 23.06.2019 12:40, Emilyvite6251
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
image
Computers and Technology, 24.06.2019 07:00, AnaiyaKirksey8
You are most likely to automatically encode information about
Answers: 1
Do you know the correct answer?
Program in C. Use the skeleton code below. Fill the structure with all four values: views, user, tim...

Questions in other subjects: