j***g 发帖数: 19 | 1
get two file names: deleted=".deleted" | "xxx/.deleted"
tmpfile=".tmpfile" | "xxx/.tmpfile"
if ".dellock" cannot be created, return
what if ".dellock" already existed?
Lock ".dellock" QUESTION: can we guarantee ".dellock" to be locked?
why not check the return value? such as
if (flock(fd,LOCK_EX)==-1) return -1;
If that board is readonly, unlock ".dellock" and return.
create tmpfile ".tmpfile" |
|
y***i 发帖数: 92 | 2 Hi:
I have found the following error in my apache server's
error_log
file.
[Mon Feb 12 15:10:35 2001] [error] [client XXX.XXX.XXX.XXX]
Symbolic link not allowed: /home/httpd/cgi-bin/tmpfiles/
Please tell me how to solve this problem? urgent.
BTW, the "tmpfiles" directory is only a link to any other
directory in order to protect the data.
I use " ln -s /data/tmpfiles tmpfiles" command under
/home/httpd/cgi-bin directory.
Thanks a lot
Appreciate your help, tommy.
Yanzi |
|
k**e 发帖数: 86 | 3 You can create a method referring to the below code, then
call this method recursively:
File currentDir = new File(String yourDir);
String[] subDirs = currentDir.list(new FilenameFilter(){
public boolean accept(File dir, String name)
{
// add your code here
/*
File tmpFile = new File(name);
return tmpFile.isDirectory();
*/
}
}); |
|
x******a 发帖数: 6336 | 4 I got thousands problems on the following piece of code "dumpfile.h" when I
compile under cygwin. it is ok under visual stduio... can anyone help?
Thanks!
#include
#include
#include //ostream_iterator
#include //cerr
#include //std::copy
template
void dump_to_file(const char* filename, const std::vector& v_d){
std::ofstream ofs(filename);
if(!ofs){
std::cerr<<"Unable to open the file to write!n";
return ;... 阅读全帖 |
|
c*****t 发帖数: 1879 | 5 I think he meant to use shell variables, hence $@ he mentioned.
Usually, the general method uses PID as part of the file name.
So if you have an unique program called mycgiprogram which temperarily
generate an HTML file, so you would specifiy a shell (/bin/sh)
variable:
TMPFILE=/tmp/mycgiprogram.$$.html
and put everything in $TMPFILE. |
|
j***g 发帖数: 19 | 6 1 int
2 delete_range(filename,id1,id2)
3 char *filename ;
4 int id1,id2 ;
5 {
6 struct fileheader fhdr;
7 char tmpfile[ STRLEN ], deleted[ STRLEN ];
8 int fdr, fdw, fd;
9 int count;
10
11 tmpfilename( filename, tmpfile, deleted );
12 if((fd = open(".dellock",O_RDWR|O_CREAT|O_APPEND, 0644)) == -1)
13 return -1;
14 flock(fd,LOCK_EX);
15
16 if((fdr |
|
k******r 发帖数: 2300 | 7 Thanks for your reply.
Here is an example from the tutorial referenced by you.
trap 'rm -f $TMPFILE; exit 0' 1 2 15
My question is that are signals system defined? How'd I know their meanings?
Guess I should get a good Unix book. Any recommendation?
if |
|
g**r 发帖数: 425 | 8 filename tmepfile "a file location file.log";
proc printto log=tmpfile;
run; |
|