Skip to main content
1-Visitor
January 2, 2020
Solved

Write log file

  • January 2, 2020
  • 1 reply
  • 2033 views

Hi,

 

Some one please suggest me the methods/steps to write log file in a creo parametric toolkit application.

 

I tried using PTApplsUnicodeFopen() but when i try to add header file PTApplsUnicodeUtils.h gives unresolved external error.

 

Please tell me the how to write a log file in creo parametric toolkit application

 

Thanks 

Best answer by remy

There are multiple ways to write a log file in your application.

The most straightforward consists in writing in a file.

If you code with C:

//create a global variable:
FILE *log;

//open the file (when needed):
log = fopen("your_log_file_name.log", "w");

//From your function(s), call fprintf() to write stuff in your file when required:
fprintf(log, "%d %s\n", <my_integer>, <my_string>);

//when closing to the end of your application, close the file:
fclose(log);

 

An alternative consists in writing stuff in the trail file.

To perform that, rely on ProTrailfileCommentWrite().

1 reply

remy21-Topaz IAnswer
21-Topaz I
January 3, 2020

There are multiple ways to write a log file in your application.

The most straightforward consists in writing in a file.

If you code with C:

//create a global variable:
FILE *log;

//open the file (when needed):
log = fopen("your_log_file_name.log", "w");

//From your function(s), call fprintf() to write stuff in your file when required:
fprintf(log, "%d %s\n", <my_integer>, <my_string>);

//when closing to the end of your application, close the file:
fclose(log);

 

An alternative consists in writing stuff in the trail file.

To perform that, rely on ProTrailfileCommentWrite().