Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. void valoreN()
  2. {
  3. //F = fopen("db.bin","rb");
  4. fseek(F,sizeof(int),SEEK_SET);
  5. int lunghezza;
  6. fread(&lunghezza,sizeof(int),1,F);
  7. //int lunghezza=ftell(F);
  8. printf("N VALE: %d",lunghezza);
  9. }
  10.  
  11. int _tmain(int argc, _TCHAR* argv[])
  12. {
  13. F = fopen("db.bin","rb");
  14. if(F==NULL)
  15. {
  16. F = fopen("db.bin","wb");
  17. do
  18. {
  19. printf("file di salvataggio non trovato! \nQuanti interi vuoi usare(MAX 10'000 e MIN 1)? ");
  20. scanf("%d",&n);
  21. fwrite(&n,sizeof(int),1,F);
  22. }
  23. while((n>10000)||(n<1));
  24. }
  25. valoreN();
  26. fclose(F);
  27.  
  28.  
  29. vettore=(articolo *)malloc(sizeof(articolo)*n);
  30. do{
  31. menu();}
  32. while(sceltamenu!=7);
  33. getch();
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement