R. Clayton (rclayton@clayton.cs.monmouth.edu)
(no date)
If the filename of the attchment has spaces, do we eliminate the spaces or
change them to underscores (or does it matter)?
It doesn't matter because unix can deal with it, although not particularly
easily. To keep things from getting too weird, it would probably be best to
delete any characters not in the set [-_.a-zA-Z0-9]; for example
"A Word Document.doc" -> "AWordDocument.doc"
This makes html-encoded names look odd
"A%20Word%20Document.doc" -> A20Word20Document.doc"
but oh well.
Also is there any limit on the size of filenames?
Yes, and on posix-compliant systems you can find it with the pathconf()
system call:
cl uname -a
SunOS clayton 5.7 Generic_106541-11 sun4u sparc SUNW,Ultra-5_10
cl cat t.cc
#include <unistd.h>
#include <iostream>
#include <cstdio>
int main() {
const int i = pathconf("/", _PC_NAME_MAX);
cout << "i = " << i << "\n";
if (i < 0)
perror("pathconf() failed");
}
cl g++ t.cc
cl a.out
i = 255
cl rsh rockhopper
Last login: Wed Jun 6 09:53:46 from clayton.cs.monmouth.edu
ro uname -a
Linux rockhopper.monmouth.edu 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686 unknown
ro g++ t.cc
ro a.out
i = 255
ro
For maximum filename size I'm guessing the path argument to pathconf() can be
anything (because maximum filename size doesn't vary with file type);
however, if you're the cautious type you can use your actual path instead.
See the pathconf() man page for more details.
If you're not on a posix system, or you're using some language that doesn't
let you make unix system calls, you'll have to grub around the associated
documentation to figure out what to do.
This archive was generated by hypermail 2.0b3 on Thu Aug 02 2001 - 12:45:05 EDT