Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FILE *file = fopen ( "file1", "r" );
- if ((file != NULL ))
- {
- char line [ 128 ];
- while( ( fgets ( line, sizeof line, file ) != NULL ))
- {
- //tokenize the line based on space
- ??
- }
- 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.
- fclose ( file );
- }
- #include <stdio.h>
- #include <string.h>
- int main ()
- {
- char str[] ="- This, a sample string.";
- char * pch;
- printf ("Splitting string "%s" into tokens:n",str);
- pch = strtok (str," ");
- while (pch != NULL)
- {
- printf ("%sn",pch);
- pch = strtok (NULL, " ");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement