Advertisement
Stybyk

kousek csv

Dec 13th, 2013
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. int nacitanitypu()
  3. {
  4.    
  5.     cout << "Z ktereho souboru chcete nacitat typy ukolu ? (doporuceno: typy.csv ?) " << endl;
  6.     char typy[30];
  7.     info infa[500];
  8.     cin >> typy;
  9.  
  10.     ifstream soubor(typy,ios::in);
  11.     if (soubor.is_open())
  12.  
  13.  { cout << "Cteni typu ukolu probehlo usmesne." << endl << endl;
  14.     while (!soubor.eof())
  15.     {
  16.         soubor >> radek;
  17.        
  18.         pocet_typu++;
  19.        
  20.     substring = strtok (radek,";");
  21.     strcpy(infa[pocet_typu].jmeno,substring);
  22.     strcpy(infa[pocet_typu].zacatek,substring);
  23.     strcpy(infa[pocet_typu].konec,substring);
  24.  
  25.   while (substring != NULL)
  26.   {
  27.      
  28.      
  29.          
  30.    
  31.     substring = strtok (NULL, ";");
  32.     cout << "jmeno ukolu " << pocet_typu << " je: " << infa[pocet_typu].jmeno << endl;
  33.    
  34.   }
  35.        
  36.     }
  37.  }
  38.    
  39.    
  40.     else
  41. {
  42.         cout << "Zadany soubor neexistuje." << endl;
  43. }       return 0;
  44.  
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement