Advertisement
Guest User

pomusz

a guest
Dec 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. struct Contact {
  8.     string name;
  9.     string surname;
  10.     string phonenumber;
  11. };
  12.  
  13. int main()
  14. {
  15.     //TO SIĘ BĘDZIE POBIERAŁO Z config.txt
  16.     int n = 1;
  17.  
  18.     //Wyświetlenie plików z bazy
  19.     //Dynamiczne przydzielenie pamięci na n elementów
  20.     Contact *tab = new Contact[n];
  21.     for (int i = 0; i < n; i++) {
  22.         char filename[100];
  23.         FILE *file;
  24.         sprintf_s(filename, "user%d.txt", i);
  25.         fopen_s(&file, filename, "a+");
  26.         fscanf_s(file, "%s", &tab[i].name);
  27.         cout << tab[i].name;
  28.         fclose(file);
  29.     }
  30.  
  31.     //Dodanie uzytkownika do bazy danych
  32.  
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement