OFD(Open File Description)

OFD(Open File Description)是一种由中国电子技术标准化研究院主导制定的国家标准版式文档格式,类似于PDF,但具有自主知识产权和更高的安全性。它广泛应用于电子公文、电子证照、电子发票等领域。
1、如何打开OFD文件?

要打开OFD文件,您需要安装专门的阅读器软件。以下是具体方法:

    ‌安装官方阅读器‌:访问增值税发票查验平台官网,在“相关下载”页面下载“增值税电子发票版式文件阅读器”并安装‌。
    ‌使用WPS‌:安装WPS Office后,直接将OFD文件拖入WPS即可打开‌。
    ‌在线转换工具‌:通过百度搜索可信赖的在线OFD转换工具,上传文件后转换为PDF或其他格式查看‌。
2、OFD与PDF的主要区别

    ‌法律效力‌:OFD是国家税务总局认可的电子发票格式,可作为报销入账凭证;PDF仅为预览版,无法律效力‌。
    ‌查验功能‌:OFD文件可验证电子签名和监制章真伪,PDF无法保证真实性‌。
    ‌归档要求‌:使用OFD电子件归档无需保存纸质文件,而PDF需同步保存XML原件‌。

使用WPS的导出功能即可轻松转换:

    用WPS打开OFD文件。
    点击左上角“文件” → “导出” → “导出为PDF”。
    选择输出路径并导出,转换后的PDF文件将保存在原文件旁‌。
3、适用场景建议

    ‌优先使用OFD‌:财务报销、税务合规、长期归档等对安全性要求高的场景‌。
    ‌PDF仅作预览‌:临时查看或非正式场景‌。

// filename lock-1.c (1)编辑如下程序 more lock-1.c #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/file.h> #include <wait.h> #define PATH "/tmp/lock" int main() 22 { int fd; pid_t pid; fd = open(PATH, O_RDWR|O_CREAT|O_TRUNC, 0644); if (fd < 0) { perror("open()"); exit(1); } if (flock(fd, LOCK_EX) < 0) { perror("flock()"); exit(1); } printf("%d: locked!\n", getpid()); pid = fork(); if (pid < 0) { perror("fork()"); exit(1); } if (pid == 0) { /* fd = open(PATH, O_RDWR|O_CREAT|O_TRUNC, 0644); if (fd < 0) { perror("open()"); exit(1); } */ if (flock(fd, LOCK_EX) < 0) { perror("flock()"); exit(1); } printf("%d: locked!\n", getpid()); exit(0); } wait(NULL); unlink(PATH); sleep(10); exit(0); } (2)# gcc lock-1.c -o lock-1 ## 编译 # ./lock-1& ## 运行,可能的结果如下:(并未达到锁的目的) 23 [wys@ai codes]$ 2854628: locked! 2854629: locked! [wys@ai codes]$ lslocks|grep lock lock-1 2855077 FLOCK WRITE 0 0 0 /tmp/lock (deleted) ### man lslocks #查看 lslocks 手册 COMMAND The command name of the process holding the lock. PID The process ID of the process which holds the lock or -1 for OFDLCK. TYPE The type of lock; can be FLOCK (created with flock(2)), POSIX (created with fcntl(2) and lockf(3)) or OFDLCK (created with fcntl(2). SIZE Size of the locked file. MODE The lock's access permissions (read, write). If the process is blocked and waiting for the lock, then the mode is postfixed with an '*' (asterisk). M Whether the lock is mandatory; 0 means no (meaning the lock is only advisory), 1 means yes. (See fcntl(2).) START Relative byte offset of the lock. END Ending offset of the lock. PATH Full path of the lock. If none is found, or there are no permissions to read the path, it will fall back to the device's mountpoint and "..." is appended to the path. The path might be truncated; use --notruncate to get the full path. BLOCKER The PID of the process which blocks the lock. [wys@ai codes]$ ./lock-1& [wys@ai codes]$ 2940080: locked! 2940081: locked! [wys@ai codes]$ cat /proc/locks |grep 2940080 41: FLOCK ADVISORY WRITE 2940080 00:22:127297 0 EOF ### man proc ## 可查看/proc/locks 的手册 /proc/locks This file shows current file locks (flock(2) and fcntl(2)) and leases (fcntl(2)). An example of the content shown in this file is the following: 1: POSIX ADVISORY READ 5433 08:01:7864448 128 128 2: FLOCK ADVISORY WRITE 2001 08:01:7864554 0 EOF (1) The ordinal position of the lock in the list. (2) The lock type. Values that may appear here include: FLOCK This is a BSD file lock created using flock(2). OFDLCK This is an open file description (OFD) lock created using fcntl(2). POSIX This is a POSIX byte-range lock created using fcntl(2). (3) Among the strings that can appear here are the following: ADVISORY This is an advisory lock. MANDATORY This is a mandatory lock. (4) The type of lock. Values that can appear here are: READ This is a POSIX or OFD read lock, or a BSD shared lock. 24 WRITE This is a POSIX or OFD write lock, or a BSD exclusive lock. (5) The PID of the process that owns the lock. (6) Three colon-separated subfields that identify the major and minor device ID of the device containing the filesystem where the locked file resides, followed by the inode number of the locked file. (7) The byte offset of the first byte of the lock. For BSD locks, this value is always 0. (8) The byte offset of the last byte of the lock. EOF in this field means that the lock extends to the end of the file. For BSD locks, the value shown is always EOF. 这是Linux老师布置的实验 这是实验指导书的第一二步 我应该如何操作才能完成老师的任务
最新发布
11-08
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值