I contacted you because I need help. I wish I could sort all my files. Txt limits by which I cheeks ($ 10, $ 20, $ 50, $ 100, $ 200) by searching on strings specific limit through code. Can nay one give me the example of how to search the string.
I contacted you because I need help. I wish I could sort all my files. Txt limits by which I cheeks ($ 10, $ 20, $ 50, $ 100, $ 200) by searching on strings specific limit through code. Can nay one give me the example of how to search the string.
Code:#include <stdio.h> #include <string.h> int search(char *q[], char *ne); char *ne[] = {"Jon","J","Jae","games",NULL}; int main(void) { if(search(names, "James") != -1) printf("in list.\n"); if(search(names, "Bill") == -1) printf("not found.\n"); return 0; } int search(char *q[], char *name) { int t; for(t=0; p[t]; ++t){ if(!strcmp(q[t], name)) { return t; } } return -1; /* not found */ }
Code:#include <string.h> main() { FILE *file; file = fopen("/home/jim/filename","f"); if(file==NULL) { printf("error"); } }
Try this ;
Code:#include <iostream> #include <fstream> #include <string> using namespace std; int main () { char* search = "b"; int offset; string line; ifstream file; Myfile.open ("file1.txt"); if(file.is_open()) { while(file.eof()) { getline(file,line); if ((offset = line.find(search, 0)) != string::npos) { cout << "found '" << search << endl; } } file.close(); } else cout<<"file can not be open."<<endl; return 0; }
Bookmarks