📄 wpw_w32_tape_95.html
字号:
<HTML>
<HR><A NAME=WIN32_TAPE_ACCESS>
Return to <a href="wpw_w32_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: Writing to a tape</H4><PRE>
Hi all,
Does any net-folk have success in writing to tape using the standard C
library function write()?
Assume the following sequence of operations on a tape:
Win32 API C Library
a) open tape CreateFile open
b) set tape block size SetTapeParameter
c) rewind tape SetTapePosition
d) write first data block WriteFile write
e) write first file mark WriteTapemark
f) write second block WriteFile write
g) write second file mark WriteTapemark
f) rewind tape SetTapePosition
g) read first data block ReadFile read
h) forward skip first file mark SetTapePosition
i) read second data block ReadFile read
j) close tape CloseHandle close
If I confine tape manipulations to the Win32 API only, there's no problem.
I've also experimented with mixing Win32 calls and C library functions a
bit. I work with a file descriptor where possible, but keep its corres-
ponding handle (obtained from _get_osfhandle()) handy so I can drop down
to the Win32 API.
I found that I can get away with using C library calls as far as open(),
read() and close(), but not write(). I write in 32k byte (logical) blocks.
In steps d) and g), if I use write(), it will return success, claiming
all 32k bytes have been written. However, I can manage a partial read at
best, in steps g) and i), whether I use read() or ReadFile().
OTOH, if I use WriteFile() in steps d) and g), I can read all data back in
steps g) and i), again whether I use read() or ReadFile().
I use the Borland 4.5 Compiler. At this point, I'm not sure the problem's
in the write() function (which probably is implemented using WriteFile()),
the NT tape driver (I'm running 3.5.1 Workstation (beta)), or something
that I've overlooked (like tape initialization, I/O setup, etc.).
OBTW, after power cycling a machine, I always get the ERROR_BUS_RESET error
whenever I try to access a tape. By trial and error, I find setting tape
block size to 0 (step b) above) seems to solve the problem for some drive
types, but not all. Is there a definitive, end-all solution to this?
Thanks much in advance for any pointers,
Leung Cheung
lch@netcom.com
</PRE>
<HR><A NAME=WIN32_FREE_TAR>
Return to <a href="wpw_w32_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: A tar program that supports long filename</H4><PRE>
Christian Glomb (clausf@eikon.regent.e-technik.tu-muenchen.de) wrote:
: Hi everybody!
: Can somebody help me finding a TAR program which works with Windows-NT's
: long filenames?
: DOS-TAR works fine but is not able to write some UNIXy filenames onto
: the filesystem :-(((
: If you can help me, please mail to
: flachen@emt.e-technik.tu-muenchen.de
: ThanX a lot
Look at CICA, there are free GNU ports of TAR and GZIP :-
ftp.cica.indiana.edu:/pub/pc/win3/nt
--
Lucien Cinc (lcinc@cs.newcastle.edu.au)
Author of WinOne, a Super Command Line Shell for Win3.1, WinNT & Win32s
3.1: ftp.cica.indiana.edu:/pub/pc/win3/util/w_one49a.zip & w_one49b.zip
NT: ftp.springsoft.com:/pub/springsoft/win32/shell/ntcmd64.zip
</PRE>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -