There is a file with different information, for example:

01:01:23: Server started on 127.0.0.1:28015 01:01:23: Connecting to authentication server #1 ... 01:01:23: Server external IP: 127.0.0.1 01:01:23: Receiving authentication data from server #1 ... 01:01:23: Hardware ID: f42dffb20dd3a91339a8f1d56860c203 01:01:23: You can't run server with RustExtended on this IP with this port. Please purchase this modification from a developer before to use. 01:01:33: Server started on 127.0.0.1:28015 01:01:33: Connecting to authentication server #1 ... 01:01:34: Server external IP: 127.0.0.1 01:01:34: Receiving authentication data from server #1 ... 

How among all this information to get exactly what will be instead of f42dffb20dd3a91339a8f1d56860c203 , for further work with this value?

Closed due to the fact that off-topic participants jfs , Kromster , insolor , zed , αλεχολυτ Aug 28 '17 at 8:28 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The message contains only the text of the task, in which there is no description of the problem, or the question is purely formal (" how do I do this task ") . To reopen the question, add a description of the specific problem, explain what does not work, what you see the problem. " - jfs, Kromster, insolor, zed, αλεχολυτ
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    You can often use regular expressions to get what you need among all this information. For example, on perl or with words in python . If necessary, you can create a parser - jfs

2 answers 2

 int main() { string s; while (cin>>s) if (s == "ID:") break; cin >> s; cout << "Ваш ID = " << s; } 

Your ID = f42dffb20dd3a91339a8f1d56860c203

Cheap and angry. This is in C ++, but in clear lines there are also functions for reading individual words from the input stream.

  • 3
    Why give an answer in a language that is not listed in the question tags? Such an answer is almost useless. - zed
  • Then, in my experience, patients very often confuse languages, and C means C ++. However, in this case, the author went even further, and confused C with C #. - Andrey Ivanov
 1.c [----] 22 L:[ 1+17 18/ 26] *(266 / 283b) 0034 0x022 [*][X] #include <stdio.h> #include <string.h> void main(){ char buf[BUFSIZ]; char *id; char *id_str="Hardware ID: "; FILE *file=fopen("log","r"); while(!feof(file)){ fgets(buf,sizeof(buf),file); id=strstr(buf,id_str); if(id){ id+=strlen(id_str); printf("Ya podebil: %s",id); } } } 
  • C ++? The question is given on C #! - Azymok
  • This is never C ++, the answer to C ++ is slightly lower. The question was asked on C, the code is also in C. - bukkojot
  • # Forgot to add - I apologize. Need C # - Azymok