segmentation fault - how to parse URLs in c using sscanf()? -


This is my C code that reads a list of URLs from a file, and attempts to isolate different parts of the URL Does. . It's just parsing roughly, I'm not worried about special cases .. I think there is something wrong with the sscanf () statement, when I run it, I get a "partition fault" and moreover , The full URL is being assigned to the "Prot" string .. Anybody can help you understand the problem .. Please, it is necessary.

  # include & lt; Stdio.h & gt; #to & lt include, string.h & gt; #to & lt include, stdlib.h & gt; # BAG_SIZE defines 14-character bag [117] [30]; Zero initbag () {strcpy (bag [0], "account"); Strcpy (bag [1], "audit"); Strcpy (bag [2], "advertising"); Strcpy (bag [3], "advertising"); Strcpy (bag [4], "marketing"); Strcpy (bag [5], "application"); Strcpy (bag [6], "banking"); Strcpy (bag [7], "barter"); Strcpy (bag [8], "business"); Strcpy (bag [9], "econo"); Strcpy (bag [10], "commerce"); Strcpy (bag [11], "communication"); Strcpy (bag [12], "computer"); Strcpy (bag [13], "resource"); } / * Other bags [] Prices will be copied later * / Zero substr (char dest [10], char src [200], int start, int len) {int i, j; For (i = start, j = 0; i & lt; start + lane; i ++, j ++) dest [j] = src [i]; Destination [j] = '\ 0'; } Got int (four * words) {int i; For (i = 0; i & lt; BAG_SIZE; i ++) if (strcmp (word, bag [i])) || (strstr (bag [i], word) = null) 1 return; Return 0;} Zero Main () {int i, j, k; four fond [10], fullural [100]; four proto [5], www [4], host [100], token [200], TLD [ 4]; (i = 0; i  

Many answers here:

< / Html>

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -