Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- int main()
- {
- clrscr();
- char Driver[40] ,From[10], To[10];
- int BUS=0;
- FILE *sfile;
- if ((sfile = fopen("c:\bus.txt", "a+")) == NULL)
- BUS = 1;
- else
- {
- do
- {
- fscanf(sfile,"%i %[^/]%*c %[^/]%*c %[^/]%*c", &BUS, Driver, From, To);
- }
- while (!feof(sfile));
- BUS += 1; //also tried BUS = BUS + 1; but no go//
- }
- printf("BUS No.: %04i", BUS); //here display shows up until 0002 only.//
- printf("nDriver: ");
- fflush(stdin);
- gets(Driver);
- printf("Routen");
- printf("From: ");
- gets(From);
- printf("To: ");
- gets(To);
- printf("nRecord saved!");
- fprintf(sfile,"%i %s/ %s-%sn", BUS, Driver, From, To);
- fclose(sfile);
- getch();
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement