admin 发表于 2015-1-21 12:57:22

Teamcenter ITK二次开发源码分享:创建自定义文件夹



Teamcenter ITK二次开发源码分享:创建自定义文件夹
输入的第一个参数是文件夹名称,第二个是文件夹描述。


#include <tc/tc.h>
#include <tccore/aom.h>
#include <tc/folder.h>
#include <tccore/workspaceobject.h>

#define EXIT_FAILURE 1

static void report_error_stack( void )
{
      int
            n_errors = 0,
            i = 0;
      const int
            *severities = NULL,
            *statuses = NULL;
      const char
            **messages;

   EMH_ask_errors( &n_errors, &severities, &statuses, &messages );
   printf( "Error(s): \n");
   for (i = 0; i < n_errors; i++)
   {
         printf( "    %6d: %s\n", statuses, messages );
   }
   exit(EXIT_FAILURE);
}

int ITK_user_main(int argc, char* argv[])
{
    int
      status;
    char
      folder_name,
      fldr_desc,
      *message;
    tag_t
      new_folder;

    ITK_initialize_text_services( 0 );
    status = ITK_auto_login();
    if(status!= ITK_ok)
    {
      report_error_stack();
    }
    else
    {
      printf("iMAN login successful.\n");
    }

    ITK_set_journalling(TRUE);

    if (argc > 1) strcpy(folder_name, argv);
    else
    {
      printf(" Specify the Input in Following format : \n");
      printf("program_name folder_namefolder_description\n");
      printf("E.g. create_folder phase_3 working_folder_for_phase_3_items\n");
      return ITK_ok;
    }   

    if (argc > 2) strcpy( fldr_desc, argv);
    else strcpy( fldr_desc,"");

    status = FL_create( folder_name, fldr_desc, &new_folder);
    if(status!= ITK_ok) report_error_stack();

    status = AOM_save(new_folder);
    if(status!= ITK_ok)report_error_stack();
    elseprintf("Folder '%s' Saved; ", folder_name);

    status = AOM_unlock(new_folder);
    if(status!= ITK_ok)report_error_stack();
    elseprintf("Unlocked; ");

    status = FL_user_update_newstuff_folder(new_folder);
    if(status!= ITK_ok) report_error_stack();
    elseprintf("Put in Newstuff Folder.\n");

    ITK_exit_module(TRUE);
    return status;
}

pop227mm1 发表于 2017-6-21 08:41:22

萌新请问 这个创建了的文件夹 在哪里可以查看
页: [1]
查看完整版本: Teamcenter ITK二次开发源码分享:创建自定义文件夹