Advertisement
CODE_TOLD_FAST

02/S.C11

Jan 19th, 2020
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1.  
  2. //:         VIDEO: https://www.youtube.com/watch?v=kSsQtozz4iA
  3. //:       CHANNEL: CODE_TOLD_FAST
  4. //: PASTEBIN_NAME: 02/S.C11
  5.  
  6. //: Summary: Sub program called by main program.
  7.  
  8. #include <stdio.h> //:for: printf(...)
  9.  
  10. //! -------------------------------------------------------- !//
  11. //! Create and populate file with arguments passed to func   !//
  12. //! to simulate the main program running a sub program that  !//
  13. //! creates some type of meaningful data that the main       !//
  14. //! program can further use. ------------------------------- !//
  15. int main( int argc, char** argv ){
  16.     printf("[S.C11:BEG:main]\n");
  17.    
  18.     FILE* file = fopen( "txt.txt", "w" );
  19.  
  20.     int data = 666;
  21.     fprintf( file, "[HARD_CODED_DATA]:%d\n", data );
  22.  
  23.     for( int i = 0; i < argc; i++ ){
  24.  
  25.         fprintf( file, "[ARG]:%s\n", argv[ i ] );
  26.        
  27.     };;
  28.  
  29.     fclose( file );
  30.    
  31.     printf("[S.C11:END:main]\n");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement