Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4. int main()
  5. {
  6. clrscr();
  7.  
  8. char Driver[40] ,From[10], To[10];
  9. int BUS=0;
  10.  
  11. FILE *sfile;
  12. if ((sfile = fopen("c:\bus.txt", "a+")) == NULL)
  13. BUS = 1;
  14. else
  15. {
  16. do
  17. {
  18. fscanf(sfile,"%i %[^/]%*c %[^/]%*c %[^/]%*c", &BUS, Driver, From, To);
  19. }
  20. while (!feof(sfile));
  21. BUS += 1; //also tried BUS = BUS + 1; but no go//
  22. }
  23. printf("BUS No.: %04i", BUS); //here display shows up until 0002 only.//
  24. printf("nDriver: ");
  25. fflush(stdin);
  26. gets(Driver);
  27. printf("Routen");
  28. printf("From: ");
  29. gets(From);
  30. printf("To: ");
  31. gets(To);
  32. printf("nRecord saved!");
  33. fprintf(sfile,"%i %s/ %s-%sn", BUS, Driver, From, To);
  34. fclose(sfile);
  35.  
  36. getch();
  37. return (0);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement