Advertisement
Guest User

scriptprova

a guest
Jul 30th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. FILE *fd;
  7. int i=0;
  8.  
  9. /* apre il file in scrittura */
  10. fd=fopen("scrivi.txt", "a");
  11. if( fd==NULL ) {
  12. perror("Errore in apertura del file");
  13. exit(1);
  14. }
  15.  
  16.  
  17.  
  18. for(i=0;i<999;i++)
  19. {
  20. /* scrive il numero */
  21. fprintf(fd, "<div class=\"content\"><div><a href=\"images/");
  22. if (i<100)
  23. {
  24. if (i<10)
  25. {
  26. fprintf(fd, "0");
  27. }
  28. fprintf(fd, "0");
  29. }
  30. fprintf(fd, "%d", i);
  31. fprintf(fd, ".jpg\"><img src=\"");
  32. if (i<100)
  33. {
  34. if (i<10)
  35. {
  36. fprintf(fd, "0");
  37. }
  38. fprintf(fd, "0");
  39. }
  40. fprintf(fd, "%d", i);
  41. fprintf(fd, "_thumb.jpg\" /></a></div> </div>\n");
  42.  
  43.  
  44.  
  45. }
  46. /* chiude il file */
  47. fclose(fd);
  48.  
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement