Advertisement
easternnl

Create file with LoadRunner

Mar 23rd, 2016
3,289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Name and location of a file to be open or created.    
  2. char * filename = "c:\\temp\\logfile.txt";    
  3. /*** access mode ***      
  4. * r or r+ = open for reading      
  5. * w or w+ = open for writing      
  6. * a or a+ = open for appending      
  7. * t = text mode      
  8. * b = binary mode      
  9. * where the "+" sign indicates that the file must already exist      *******************/    
  10. // Open the file with append mode    
  11. char * access_mode = "a+";    
  12. //File pointer    
  13. long file_stream;          
  14. if ((file_stream = fopen(filename, access_mode)) == NULL) {        
  15. lr_error_message ("Cannot open or create %s", filename);        
  16. return -1;    
  17. }    
  18. //Write message to output file    
  19. fprintf(file_stream, "This is the message to output file");          
  20. //Close the file stream    
  21. fclose(file_stream);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement