Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define FILENAME "testx.c"
- int main(){
- int i = 0,j, counter = 0;
- char s[50][100];
- FILE *fp;
- fp = fopen(FILENAME,"r");
- while (fgets(s[i],100,fp) != NULL)
- i++;
- fclose(fp);
- fp = fopen(FILENAME,"w");
- for(j = 0; j < i; j++)
- fprintf(fp,"/* %d */ %s",counter++,s[j]);
- fclose(fp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment