thieumao

Liệt kê mẫu trong tệp dữ liệu - anhkhang

Sep 15th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. // •  Liệt kê mẫu trong tệp dữ liệu
  2.  
  3. FILE *f;
  4. char strPathSign[]="mn.kkt";
  5. fopen_s(&f,strPathSign,"rb");
  6. m_Sign sign;
  7. char chuoi[18]="";
  8. System::String ^tmp="";
  9. int i=0;
  10. int posEnd;
  11. //Xác định kích thước file
  12. fseek(f,0,SEEK_END);
  13. posEnd=ftell(f);
  14. //Trả về vị trí ban đầu
  15. fseek(f,0,SEEK_SET);
  16. //Tiến hành vòng lặp liệt kê mã nhận dạng
  17. while (ftell(f) < posEnd)
  18. {
  19.     i++;
  20.     fread(&sign,sizeof(m_Sign),1,f);
  21.     strncpy(chuoi,sign.Name,17);
  22.     tmp = gcnew System::String(chuoi);
  23.     lstVirus->Items->Add(tmp);
  24. };
  25. fclose(f);
  26. lblCount->Text=Convert::ToString(i);
Advertisement
Add Comment
Please, Sign In to add comment