Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. FILE *file = fopen ( "file1", "r" );
  2.  
  3. if ((file != NULL ))
  4. {
  5. char line [ 128 ];
  6. while( ( fgets ( line, sizeof line, file ) != NULL ))
  7. {
  8. //tokenize the line based on space
  9.  
  10. ??
  11.  
  12. }
  13. how to add text at the end of the line? i mean i have **today is monday** and i want to add for example **Yupppy** at the end of today is monday line.
  14.  
  15. fclose ( file );
  16.  
  17. }
  18.  
  19. #include <stdio.h>
  20. #include <string.h>
  21.  
  22.  
  23.  
  24.  
  25. int main ()
  26. {
  27.   char str[] ="- This, a sample string.";
  28.   char * pch;
  29.   printf ("Splitting string "%s" into tokens:n",str);
  30.   pch = strtok (str," ");
  31.   while (pch != NULL)
  32.   {
  33.     printf ("%sn",pch);
  34.     pch = strtok (NULL, " ");
  35.   }
  36.   return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement