Add text with edit in memo



  • I need to add a text with edit in memo in one line. I've sold this code, but I don't understand its meaning:

    char nazva[15];
    strcpy(nazva, Edit1->Text.c_str());
    float price = StrToFloat(Edit2->Text);
    int kol = StrToInt(Edit3->Text);
    

    fprintf(f, "%s %6.2f %i\n", nazva, price, kol);
    fclose(f);
    Edit1->Clear();
    Edit2->Clear();
    Edit3->Clear();
    Edit1->SetFocus();



  •     char nazva[30];
       char kod_INN[30];
       char ed_izm[10];
    
        strcpy(nazva, Edit1->Text.c_str());
        strcpy(kod_INN, Edit2->Text.c_str());
        strcpy(ed_izm, Edit3->Text.c_str()); функция strcpy копирует значение 
                                переведённой строки из типа string в тип char
    
       int kol = StrToInt(Edit4->Text);
       float price_not_PDV = StrToFloat(Edit5->Text);
       float summa_not_PDV = StrToFloat(Edit6->Text);
    
         Memo1->Clear();
    
       AnsiString str; // объявляем переменную для строки AnsiString
          str.printf("%s %s %s %d %4.2f %4.2f\n", nazva, kod_INN,
          ed_izm, kol, price_not_PDV, summa_not_PDV); // для переменной str записуем функцию printf
         Memo1->Lines->Add(str); 
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2