├── LIST ├── README.md ├── color.h ├── gotoxy.h ├── main.cpp ├── main.exe ├── main.o └── read.h /LIST: -------------------------------------------------------------------------------- 1 | 1001252 2 | nisha 3 | 1001253 4 | tarun 5 | 1001254 6 | talli 7 | 1001255 8 | monu 9 | 1001256 10 | meenakshi 11 | 1001257 12 | kamlesh 13 | 100258 14 | ram 15 | 1001259 16 | rajender 17 | 1001260 18 | karan 19 | 1001261 20 | nandram 21 | 1001262 22 | nipun 23 | 1001263 24 | daksh 25 | 1001264 26 | daizy 27 | 1001265 28 | suman 29 | 1001266 30 | nishu 31 | 1001267 32 | sushma 33 | 1001268 34 | ram_nivas 35 | 1001269 36 | ram_narain 37 | 1001270 38 | tarun_narain 39 | 1001271 40 | sunil kumar 41 | 1001272 42 | suman 43 | 1001273 44 | poonam 45 | 1001274 46 | pooja 47 | 1001275 48 | karan_veer 49 | 1001276 50 | johar 51 | 1001277 52 | ritik 53 | 1001278 54 | vijay 55 | 1001279 56 | twinkle 57 | 1001280 58 | tony 59 | 1001281 60 | nitin 61 | 1001282 62 | amit 63 | 1001283 64 | vicky 65 | 1001284 66 | birbal 67 | 1001285 68 | akbar 69 | 1001286 70 | tony_stark 71 | 1001287 72 | steve_jobs 73 | 1001288 74 | mark_zukkerburg 75 | 1001289 76 | bill_gates 77 | 1001290 78 | jerry_mouse 79 | 1001291 80 | tom_cat 81 | 1001292 82 | bruno_mars 83 | 1001293 84 | shahrukh_khan 85 | 1001294 86 | vikas 87 | 1001295 88 | sang Grell 89 | anthony Freese 90 | cinda Lague 91 | raven Cromer 92 | nicol Vermeulen 93 | thaddeus Alter 94 | valerie Lager 95 | patience Mares 96 | tlizebeth Eagle 97 | jessia Lane 98 | alleen Morvant 99 | alexandria Lipson 100 | bobbye Falzone 101 | maximina Foust 102 | blake Sitton 103 | bernita Feggins 104 | marcus Mcginn 105 | lita Bogner 106 | tiffany Jelinek 107 | Jacinda Begley 108 | viki Slusser 109 | lady Swilley 110 | bryanna Wainwright 111 | jennefer Breece 112 | anna Gilchrest 113 | lucius Knee 114 | kristina Koll 115 | noemi Cardona 116 | paulita Schmelzer 117 | marcelle Scribner 118 | Jason Flippin 119 | Kaitlyn Towle 120 | Brain Boris 121 | Caroyln Brigance 122 | Patti Chirico 123 | Aaron Shimkus 124 | Bibi Toal 125 | Irving Hypes 126 | Rufus Molinar 127 | Antoinette Messer 128 | Karoline Shue 129 | Zachary Hasting 130 | Linnea Capra 131 | Athena Eisenhart 132 | Dotty Kieffer 133 | Tamekia Strange 134 | Toshiko Novack 135 | Trudie Karst 136 | Peggy Hagood 137 | Dorothea Ogg 138 | Loraine Beutler 139 | Marcell Mcnerney 140 | Sachiko Akey 141 | Willene Waldrep 142 | Doug Younan 143 | Dorotha Mountjoy 144 | Laveta Caffee 145 | Kent Emery 146 | Alana Tutor 147 | Torri Rozell 148 | Agustina Aguero 149 | Alda Nussbaum 150 | Shawanda Sumrell 151 | Madie Lampkin 152 | Aletha Grist 153 | Charity Hewes 154 | Lena Welcome 155 | Shanelle Taft 156 | Ji Spanbauer 157 | Brigette Cummingham 158 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Search-Text-File-Handling-C- 2 | Search Like you Search your Contacts in phone (Sub Strings) 3 | -------------------------------------------------------------------------------- /color.h: -------------------------------------------------------------------------------- 1 | #include //header file for windows 2 | #include //C standard library 3 | 4 | void SetColor(int ForgC) 5 | { 6 | WORD wColor; 7 | //We will need this handle to get the current background attribute 8 | HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); 9 | CONSOLE_SCREEN_BUFFER_INFO csbi; 10 | 11 | //We use csbi for the wAttributes word. 12 | if(GetConsoleScreenBufferInfo(hStdOut, &csbi)) 13 | { 14 | //Mask out all but the background attribute, and add in the forgournd color 15 | wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F); 16 | SetConsoleTextAttribute(hStdOut, wColor); 17 | } 18 | return; 19 | } 20 | -------------------------------------------------------------------------------- /gotoxy.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | COORD coord={0,0}; 5 | 6 | void gotoxy(int x,int y) 7 | { 8 | coord.X=x; 9 | coord.Y=y; 10 | SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "read.h" 6 | #include "color.h" 7 | #include "gotoxy.h" 8 | using namespace std; 9 | 10 | class search1 11 | { 12 | char s[12]; 13 | int i,j,x,m,y,d; 14 | string line; 15 | string code; 16 | char p; 17 | string lines[900]; 18 | public: 19 | search1() 20 | {j: 21 | for(i=0;i<=10;i++) 22 | { 23 | int l=6; 24 | if(i==0){ gotoxy(29,0); SetColor(2); 25 | cout << "Welcome To TDS Search \n\n";SetColor(7); 26 | cout << "ENTER NAME : ";} 27 | d=i+13; 28 | gotoxy(d,2); 29 | s[i]=getche(); m: 30 | p=13; 31 | if(s[i]==p) 32 | { 33 | goto td; 34 | } 35 | else if(s[i]=='\b' && i>=1) 36 | { 37 | --i; 38 | --i; 39 | system("cls"); 40 | gotoxy(29,0); 41 | SetColor(10); 42 | cout << "Welcome To TDS Search \n\n"; 43 | SetColor(7); 44 | cout << "ENTER NAME : "; 45 | for(y=0;y<=i;y++) 46 | { 47 | cout << s[y]; 48 | }goto m; 49 | } 50 | else if(s[i]=='\b' && i==0){ 51 | goto j;} 52 | system("cls"); 53 | gotoxy(29,0); 54 | SetColor(10); 55 | cout << "Welcome To TDS Search \n\n"; 56 | SetColor(7); 57 | cout << "ENTER NAME : "; 58 | for(y=0;y<=i;y++) 59 | { 60 | cout << s[y]; 61 | } 62 | cout << "\n"; 63 | cout << " ____________________________________________________________________________"; 64 | cout << "\n|S.no | NAME | ID NUM |";gotoxy(73,4); cout << " |"; 65 | cout << "\n|_____|________________|_______________|_____________________________________|\n"; 66 | for(j=1;j<=280;j++) 67 | { 68 | line=read(j,"LIST"); 69 | j++; 70 | for(x=i;x>=0;x--) 71 | { 72 | if(line[x]==s[x]) 73 | { 74 | if(x==0) 75 | { 76 | cout << "|\t";SetColor(11); 77 | gotoxy(2,l); 78 | SetColor(7); 79 | cout << l-5<<". |"; 80 | SetColor(11); 81 | gotoxy(9,l); 82 | cout <> j; 108 | cout << lines[j+5]; 109 | } 110 | 111 | }; 112 | 113 | main() 114 | { 115 | search1 obj; 116 | } 117 | -------------------------------------------------------------------------------- /main.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tarun-Narain/Search-Text-File-Handling-C-/7de0a7c327b133386e8e2d0109e5a8da26827332/main.exe -------------------------------------------------------------------------------- /main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tarun-Narain/Search-Text-File-Handling-C-/7de0a7c327b133386e8e2d0109e5a8da26827332/main.o -------------------------------------------------------------------------------- /read.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | string read(int n,char *input) 10 | { 11 | int i=0; 12 | fstream file; 13 | string line; 14 | file.open(input,ios::in); 15 | while(getline(file,line)) 16 | { 17 | file >> line; 18 | i++; 19 | if(i==n) 20 | { 21 | break; 22 | } 23 | } 24 | return line; 25 | } 26 | 27 | 28 | --------------------------------------------------------------------------------