BG Development


: (2) 1 [2]   ( ) Reply to this topicStart new topicStart Poll

>  , - C
fast_user
: 01-06-2022, 22:43
Quote Post



:
:
:

: 607
: 19.09.12



CODE

int main()
{
      char buf[] = "00000        EEEE         dgsdg           dfgdg\r\n"
                     "00014        aF45B9     RTRT            JOLDF\r\n"
                       "00036        EC5EFFFF   ERR             87YYHGGG\r\n"
                       "00002        FE             f\r\n";

      char* line = buf;
      char* end = buf;
      do
      {
            if ('\r' == *end && '\n' == *(end + 1))//line found
            {
                  end += 2;
                  for (int i = 2; i <= 8; i += 2)
                  {
                        if (line[13 + i] == ' ')
                        {
                              for (int z = 0; z < i; z += 2)
                              {
                                    char code[3];
                                    strncpy(code, &line[13 + z], 2 * sizeof(char));
                                    code[2] = 0;
                                    printf("%s\r\n", code);// 2
                              }
                              break;
                        }
                  }
                  line = end;
            }
            end++;
            
      } while (*end);

      int x = 0;
      scanf("%d", x);
}


--------------------
Linux is only free if your time has no value.
Linux Akbar
, .
PMEmail Poster
Top
avsrm
: 01-06-2022, 23:19
Quote Post



:
:
:

: 23
: 21.01.08



, , ... , .
... .
CODE




struct {
char number_data_row[5]; // .
char pause1[8]; // 8
char my_precious_data[8]; // 8
char pause2[4]; // 4 8
char schrott[21]; //
char cr_lf[2]; // - .
} Extracted_data; //[48] // - 48

pch=strstr(data_string,"00000");
memcpy(&Extracted_data,pch,48);

for(i=0;i<8;i++) ("My_precious_Data=["+IntToStr(i)+"]="+IntToStr(Extracted_data.my_precious_data[i])); // .
//
// ... .












.

avsrm 01-06-2022, 23:19


--------------------
Borland Builder C++ 6.
PMEmail Poster
Top
Bender++
: 02-06-2022, 08:40
Quote Post



:
:
:

: 334
: 18.04.21



QUOTE
if ('\r' == *end && '\n' == *(end + 1))


! !
CODE
\n
?

Bender++ 02-06-2022, 08:41


--------------------
! !
! !
- Z V
PMEmail Poster
Top
fast_user
: 02-06-2022, 09:26
Quote Post



:
:
:

: 607
: 19.09.12



QUOTE (avsrm @ 31-05-2022, 19:19)
... LF....

.
.


--------------------
Linux is only free if your time has no value.
Linux Akbar
, .
PMEmail Poster
Top
DarkOne
: 04-06-2022, 06:21
Quote Post


Group Icon
:
:
:

: 3662
: 30.01.04



QUOTE ( @ 01-06-2022, 07:49)
, .

( ).
CODE
int main()
{
ifstream f("data.txt");

string precious;
int n;

while (!f.eof())
{
f >> n;
if (f.good()) //
{
f >> precious;

if (f)
cout << precious << endl;

                 //
f.ignore(std::numeric_limits<int>::max(), '\n');
}
else // ,
{
f.clear();
f.ignore(std::numeric_limits<int>::max(), '\n');
}
}

std::cin.get();

return 0;
}


QUOTE (data.txt)
LKWHJERTLHKEVMLEHJ;JKNSN LG
DTH54634757567567567
THDRJTYIKFTKJFJXFDNXFGJHTJ
FGHFJDTYJTYJKTYJK
00000 EEEE   dgsdg   dfgdg
00002 FE   f
00003 CD f
00004 FEFE   fgdfg dfgfg675
00006 91 rt   hhj
00007 45 5678 hjmnjhm
00008 9B 34we 89789
00009 45 54564   87989
00010 a5 254536   8987
00011 45 DFDF uiyE
00014 aF45B9   RTRT JOLDF
00015 45 3456 TY65555
00018 225357   7890 FGHFGH
00030 FF 2
00031 FF 2
00032 FF 2
00036 EC5EFFFF  ERR   87YYHGGG

QUOTE (Output)
EEEE
FE
CD
FEFE
91
45
9B
45
a5
45
aF45B9
45
225357
FF
FF
FF
EC5EFFFF


DarkOne 04-06-2022, 06:28


--------------------
The man who learns only what others know
is as ignorant as if he learns nothing.
The treasures of knowledge are the most rare,
and guarded most harshly.
-- Chronicle of the First Age
PMICQ
Top
1 (1 , 0 )
, :
« | C/C++ | »

Topic Options : (2) 1 [2]  Reply to this topicStart new topicStart Poll

 


Copyright © 2003-2019 | BG Development | All Rights Reserved
RSS 2.0