我需要将多个UNIX文件转换为PC并将它们移动到特定文件夹,而不保留原始UNIX文件。
我测试了下面的命令并且它们有效,但TYPE命令保留原始UNIX文件并创建一个单独的PC文件。
C:\ TYPE input_filename | MORE /P > output_filename <<< command to conver unix to ansi, works perfect.
C:\ move c:\users\you\somefile.txt c:\temp\newlocation.txt <<< move a file to another location, work perfect.
我想知道是否有办法一起使用TYPE和MOVE命令,类似于:
C:\move c:\users\you\somefile.txt TYPE MORE /P >c:\temp\newlocation.txt
所以基本上它会将UNIX文件移动到另一个目录,同时将其格式更改为windows。
答案 0 :(得分:0)
### varholder.h
#include <stdint.h>
class VarHolder
{
public:
VarHolder() {}
virtual ~VarHolder() {}
typedef struct
{
int8_t var1;
uint8_t var2;
int64_t var3;
char str1[40];
} struct1_t;
struct1_t struct1;
}
### firststage.h
#include global.h
class FirstStage
{
public:
FirstStage() {}
~FirstStage() {}
void doFirstStage(void)
{
/* Globally defined committer instance */
g_committer_instance->mark_var_change(&varholder_instance->struct1.var1);
}
}
### secondstage.h
#include global.h
class SecondStage
{
public:
SecondStage() {}
~SecondStage() {}
template <typename T>
void doSecondStage(T new_value)
{
g_committer_instance->commit_change(new_value);
}
}
### committer.h
#include global.h
class Committer
{
public:
Committer() {}
~Committer() {}
template <typename T>
void Committer::mark_var_change(T *var)
{
/* Store a pointer to the variable */
/* SAVE SOMEWHERE PRESERVING TYPE */ = var;
}
template <typename T>
void Committer::commit_change(T new_value)
{
/* Dereferencing the previously stored pointer */
*(/*WHATEVER I STORED BEFORE*/) = new_value;
}
}
### global.h
#include varholder.h
#include committer.h
extern Committer *g_committer_instance;
extern VarHolder *varholder_instance;
### main.cpp
#include global.h
#include varholder.h
#include firststage.h
#include secondstage.h
Committer *g_committer_instance;
VarHolder *varholder_instance;
int main()
{
g_committer_instance = new Committer();
varholder_instance = new VarHolder();
FirstStage *fstage = new FirstStage();
SecondStage *sstage = new SecondStage();
int8_t var_new = 100;
/* First stage */
fstage->doFirstStage();
/* Second stage */
sstage->doSecondStage(var_new);
return 0;
}