{"id":7710,"date":"2022-09-10T01:59:04","date_gmt":"2022-09-09T20:29:04","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/"},"modified":"2022-09-10T01:59:04","modified_gmt":"2022-09-09T20:29:04","slug":"solved-printing-part-of-a-txt-file-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/","title":{"rendered":"[Solved] Printing part of a .txt file [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-37515261\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"37515261\" data-parentid=\"37514621\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Ok, continuing from the comment, and just as laid out in the comment, the first thing you need to do with any data handling problem is to read all of your data into a form that allows you to work with it as needed. Here you have varying types of data that all make up a unit (or car in this case). Whenever you have differing types of data you have to handle as a unit, you should be thinking struct. Here a struct <code>car<\/code> makes sense:<\/p>\n<pre><code>typedef struct {    \/* struct for cars *\/\n    int id;\n    char color[MAXN];\n    char manf[MAXN];\n    int year;\n} car;\n<\/code><\/pre>\n<p>You can now read each line in your data file into an array or <code>struct car<\/code> and have all data readily available for the rest of your code.<\/p>\n<p>When ever you have <em>lines<\/em> of data, you should be thinking <em>line-oriented<\/em> input, e.g. <code>fgets<\/code> or <code>getline<\/code>. While you could use the <code>scanf<\/code> family here, you are better served to read a line at a time and parse your data from each line read. Also, it is often better to parse the data into temporary variables, and then if you validate you have all accounted for, then, and only then, copy your temporary variables to your struct and increment your index. For example you could do the following:<\/p>\n<pre><code>\/* constants for max name, chars &amp; structs *\/\nenum { MAXN = 16, MAXC = 64, MAXS = 128 };\n...\n    car cars[MAXS] = {{ .id = 0 }};                \/* array of struct car *\/\n    char buf[MAXC] = \"\";\n    size_t i, j, idx = 0, nc = 0, nm = 0;\n    FILE *fp = argc &gt; 1 ? fopen (argv[1], \"r\") : stdin;\n    ...\n    while (idx &lt; MAXS &amp;&amp; fgets (buf, MAXC, fp)) {   \/* read each line *\/\n        int tid, tyr;                               \/* temp variables *\/\n        char tcol[MAXC] = \"\", tman[MAXC] = \"\";\n        \/* separate into temp variables, validate, copy to struct *\/\n        if (sscanf (buf, \" %d %s %s %d%*c\", &amp;tid, tcol, tman, &amp;tyr) == 4) {\n            cars[idx].id = tid;\n            snprintf (cars[idx].color, MAXN, \"%s\", tcol);\n            snprintf (cars[idx].manf, MAXN, \"%s\", tman);\n            cars[idx++].year = tyr;\n        }\n    }\n<\/code><\/pre>\n<p>Now you have all your data in your array of struct, and the only thing left is to determine the unique colors and manufacturers you have within your data. You do not need to re-copy your data to another array, you can simply use an array of pointers to point to the unique values within your array of structs. You can do that as follows:<\/p>\n<pre><code>    char *colors[MAXN] = {NULL}, *manfs[MAXN] = {NULL}; \/* pointer arrays *\/\n    ...\n    for (i = 0; i &lt; idx; i++) { \/* find unique colors *\/\n        if (!nc) { colors[nc++] = cars[i].color; continue; }\n        for (j = 0; j &lt; nc; j++)\n            if (!strcmp( colors[j], cars[i].color)) goto cdup;\n        colors[nc++] = cars[i].color;\n        cdup:;\n    }\n<\/code><\/pre>\n<p>(where <code>nc<\/code> is just your counter for the number of unique colors)<\/p>\n<p>You can do the same thing for your manufacturers.<\/p>\n<p>Putting all the pieces together, (and noting <em>all<\/em> of your manufacturers have <em>unique<\/em> fist letters to begin with) you could do something like this:<\/p>\n<pre><code>#include &lt;stdio.h&gt;\n#include &lt;string.h&gt;\n\n\/* constants for max name, chars &amp; structs *\/\nenum { MAXN = 16, MAXC = 64, MAXS = 128 };\n\ntypedef struct {    \/* struct for cars *\/\n    int id;\n    char color[MAXN];\n    char manf[MAXN];\n    int year;\n} car;\n\nint main (int argc, char **argv) {\n\n    car cars[MAXS] = {{ .id = 0 }};                \/* array of struct car *\/\n    char *colors[MAXN] = {NULL}, *manfs[MAXN] = {NULL}; \/* pointer arrays *\/\n    char buf[MAXC] = \"\";\n    size_t i, j, idx = 0, nc = 0, nm = 0;\n    FILE *fp = argc &gt; 1 ? fopen (argv[1], \"r\") : stdin;\n\n    if (!fp) {  \/* validate file open for reading *\/\n        fprintf (stderr, \"error: file open failed '%s'.\\n\", argv[1]);\n        return 1;\n    }\n\n    while (idx &lt; MAXS &amp;&amp; fgets (buf, MAXC, fp)) {   \/* read each line *\/\n        int tid, tyr;                               \/* temp variables *\/\n        char tcol[MAXC] = \"\", tman[MAXC] = \"\";\n        \/* separate into temp variables, validate, copy to struct *\/\n        if (sscanf (buf, \" %d %s %s %d%*c\", &amp;tid, tcol, tman, &amp;tyr) == 4) {\n            cars[idx].id = tid;\n            snprintf (cars[idx].color, MAXN, \"%s\", tcol);\n            snprintf (cars[idx].manf, MAXN, \"%s\", tman);\n            cars[idx++].year = tyr;\n        }\n    }\n    if (fp != stdin) fclose (fp);\n\n    for (i = 0; i &lt; idx; i++) \/* output all data *\/\n        printf (\"%4d  %-6s  %-10s %d\\n\", cars[i].id, cars[i].color,\n                cars[i].manf, cars[i].year);\n    putchar ('\\n');\n\n    for (i = 0; i &lt; idx; i++) { \/* find unique colors *\/\n        if (!nc) { colors[nc++] = cars[i].color; continue; }\n        for (j = 0; j &lt; nc; j++)\n            if (!strcmp( colors[j], cars[i].color)) goto cdup;\n        colors[nc++] = cars[i].color;\n        cdup:;\n    }\n\n    for (i = 0; i &lt; idx; i++) { \/* find unique manufacturers *\/\n        if (!nm) { manfs[nm++] = cars[i].manf; continue; }\n        for (j = 0; j &lt; nm; j++)\n            if (*manfs[j] == *cars[i].manf) goto mdup;\n        manfs[nm++] = cars[i].manf;\n        mdup:;\n    }\n\n    \/* output unique colors &amp; unique manufacturers *\/\n    for (i = 0; i &lt; nc; i++) printf (\"%s\\n\", colors[i]);\n    putchar ('\\n');\n    for (i = 0; i &lt; nm; i++) printf (\"%s\\n\", manfs[i]);\n    putchar ('\\n');\n\n    return 0;\n}\n<\/code><\/pre>\n<p><strong>note:<\/strong> if your did not have <em>all<\/em> unique first letters for manufacturers, you would need a full <code>strcmp<\/code> when testing like with colors, instead of just comparing the first characters.<\/p>\n<p><strong>Example Input<\/strong><\/p>\n<pre><code>$ cat dat\/cars.txt\n4132 RED ALFA-ROMEO 2005\n5230 BLUE FIAT 2004\n4321 WHITE NISSAN 2000\n5233 BLUE BMW 2001\n7300 YELLOW CITROEN 1999\n1232 BLUE PEUGEOT 1990\n9102 RED VW 1995\n1998 YELLOW ALFA-ROMEO 2004\n5333 WHITE VW 1999\n6434 BLUE NISSAN 2000\n8823 BLACK MERCEDES 2003\n4556 BLACK SEAT 1997\n1554 RED MERCEDES 2001\n6903 YELLOW NISSAN 2000\n7093 BLACK FIAT 1978\n1023 WHITE VW 1998\n3422 BLUE SEAT 2005\n3555 RED BMW 2004\n6770 YELLOW SEAT 2002\n<\/code><\/pre>\n<p><strong>Example Use\/Output<\/strong><\/p>\n<pre><code>$ .\/bin\/cars &lt;dat\/cars.txt\n4132  RED     ALFA-ROMEO 2005\n5230  BLUE    FIAT       2004\n4321  WHITE   NISSAN     2000\n5233  BLUE    BMW        2001\n7300  YELLOW  CITROEN    1999\n1232  BLUE    PEUGEOT    1990\n9102  RED     VW         1995\n1998  YELLOW  ALFA-ROMEO 2004\n5333  WHITE   VW         1999\n6434  BLUE    NISSAN     2000\n8823  BLACK   MERCEDES   2003\n4556  BLACK   SEAT       1997\n1554  RED     MERCEDES   2001\n6903  YELLOW  NISSAN     2000\n7093  BLACK   FIAT       1978\n1023  WHITE   VW         1998\n3422  BLUE    SEAT       2005\n3555  RED     BMW        2004\n6770  YELLOW  SEAT       2002\n\nRED\nBLUE\nWHITE\nYELLOW\nBLACK\n\nALFA-ROMEO\nFIAT\nNISSAN\nBMW\nCITROEN\nPEUGEOT\nVW\nMERCEDES\nSEAT\n<\/code><\/pre>\n<p><strong>Note:<\/strong> this is just to get you started. You still have to use the data however the rest of your assignment calls for, but here is one approach to getting it in manageable form. Let me know if you have any questions.<\/p>\n<hr>\n<p><strong>Simplified Version Print Non-Duplicate Color &amp; Manufacturer<\/strong><\/p>\n<p>I thought about the difficulty you were having and the basic problem in knowing how much detail you need stems from not knowing how you will ultimately use your data. Initially, you needed a way to identify the unique colors and manufacturers within your data file. The first code separates all the data into unique collections of colors and manufacturers, but leaves it up to you to implement what you needed done. However, if you simply need to output the list of cars with unique colors by unique manufacturers, then you don&#8217;t need to store an array of structs at all, you simply print those vehicles with unique color\/manufacturers until duplicates are reached. That can be done in a simplified manner as follows:<\/p>\n<pre><code>#include &lt;stdio.h&gt;\n#include &lt;string.h&gt;\n\n\/* constants for max name, chars &amp; structs *\/\nenum { MAXN = 16, MAXC = 64 };\n\nint main (int argc, char **argv) {\n\n    char colors[MAXN][MAXN] = {{0}}, manfs[MAXN][MAXN] = {{0}};\n    char buf[MAXC] = \"\";\n    size_t i, nc = 0, nm = 0;\n    FILE *fp = argc &gt; 1 ? fopen (argv[1], \"r\") : stdin;\n\n    if (!fp) {  \/* validate file open for reading *\/\n        fprintf (stderr, \"error: file open failed '%s'.\\n\", argv[1]);\n        return 1;\n    }\n\n    while (fgets (buf, MAXC, fp)) {                 \/* read each line *\/\n        int tid, tyr;                               \/* temp variables *\/\n        char tcol[MAXC] = \"\", tman[MAXC] = \"\";\n        \/* separate into temp variables, validate, copy to struct *\/\n        if (sscanf (buf, \" %d %s %s %d%*c\", &amp;tid, tcol, tman, &amp;tyr) == 4) {\n            if (!nc)    \/* 1st color - add it *\/\n                strcpy (colors[nc++], tcol);\n            else {\n                for (i = 0; i &lt; nc; i++) \/* compare against stored colors *\/\n                    if (!strcmp (colors[i], tcol)) \/* duplicate *\/\n                        goto dupe;                 \/* skip it   *\/\n                strcpy (colors[nc++], tcol);       \/* add it    *\/\n            }\n            if (!nm)    \/* do the same for manufacturers *\/\n                strcpy (manfs[nm++], tman);\n            else {\n                for (i = 0; i &lt; nm; i++)\n                    if (!strcmp (manfs[i], tman))\n                        goto dupe;\n                strcpy (manfs[nm++], tman);\n            }  \/* if not a duplicate, print the vehicle *\/\n            printf (\"%4d  %-6s  %-10s %d\\n\", tid, tcol, tman, tyr);\n            dupe:;\n        }\n    }\n    if (fp != stdin) fclose (fp);\n\n    return 0;\n}\n<\/code><\/pre>\n<p><strong>Example Use\/Output<\/strong><\/p>\n<pre><code>$ .\/bin\/cars2 &lt;dat\/cars.txt\n4132  RED     ALFA-ROMEO 2005\n5230  BLUE    FIAT       2004\n4321  WHITE   NISSAN     2000\n7300  YELLOW  CITROEN    1999\n8823  BLACK   MERCEDES   2003\n<\/code><\/pre>\n<p>Look over what is done. Each line is read and the value separated. If the color or manufacturer array is empty the first color\/manufacturer is added. For all others, the current color or manufacturer is compared against all previous and if it is a duplicate, printing is skipped for that car. Let me know if you have further questions.<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">6<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Printing part of a .txt file [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Ok, continuing from the comment, and just as laid out in the comment, the first thing you need to do with any data handling problem is to read all of your data into a form that allows you to work with it as needed. Here you have varying types of data that all make &#8230; <a title=\"[Solved] Printing part of a .txt file [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\" aria-label=\"More on [Solved] Printing part of a .txt file [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[324,493,362],"class_list":["post-7710","post","type-post","status-publish","format-standard","hentry","category-solved","tag-c","tag-file","tag-string"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] Printing part of a .txt file [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Printing part of a .txt file [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Ok, continuing from the comment, and just as laid out in the comment, the first thing you need to do with any data handling problem is to read all of your data into a form that allows you to work with it as needed. Here you have varying types of data that all make ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-09T20:29:04+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Printing part of a .txt file [closed]\",\"datePublished\":\"2022-09-09T20:29:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\"},\"wordCount\":596,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"c++\",\"file\",\"string\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\",\"name\":\"[Solved] Printing part of a .txt file [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-09-09T20:29:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Printing part of a .txt file [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Printing part of a .txt file [closed] - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Printing part of a .txt file [closed] - JassWeb","og_description":"[ad_1] Ok, continuing from the comment, and just as laid out in the comment, the first thing you need to do with any data handling problem is to read all of your data into a form that allows you to work with it as needed. Here you have varying types of data that all make ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/","og_site_name":"JassWeb","article_published_time":"2022-09-09T20:29:04+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Printing part of a .txt file [closed]","datePublished":"2022-09-09T20:29:04+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/"},"wordCount":596,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["c++","file","string"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/","name":"[Solved] Printing part of a .txt file [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-09-09T20:29:04+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-printing-part-of-a-txt-file-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Printing part of a .txt file [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/7710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=7710"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/7710\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=7710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=7710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=7710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}