c/s(C#)下Ftp的多文件上传及其上传进度
因为项目要求,制作的一个多文件上传,并显示进度条一段代码(vs2005环境)。
(只为粗略的实现,代码并不规范)
当多个文件上传的时候,需要依次队列形式一个个上传,当上传某个文件的时候,锁定进程,上传完毕再开启锁。
在主类中的上传按钮事件代码:
//
获取openFileDialog控件选择的文件名数组(openFileDialog可多个文件选择)
private
void
button1_Click(
object
sender, EventArgs e)
{
label1.Text
=
""
;
try
{
this
.openFileDialog1.ShowDialog();
path
=
this
.openFileDialog1.FileNames;
//
获取openFileDialog
控件选择的文件名数组
string
strpath
=
""
;
for
(
int
y
=
0
; y
<
path.Length; y
++
)
{
strpath
+=
path[y];
}
textBox1.Text
=
strpath;
&n
相关文档:
用了三种方法...
#if 0
void StringTokenize(const std::string& strSrc, const std::string& strDelimit, std::vector<std::string>& vecSub)
{
if (strSrc.empty() || strDelimit.empty())
{
throw "tokenize: empty string\n";
......
修改makefile,在LIBS里面加上-lmemcached,比如原来 gcc test.c,现在 gcc test.c -lmemcached。这个库就是libmemcached提供的。
然后添加#include<libmemcached/memcached.h>,这个文件也是libmemcached提供的。
主函数里面需要添加:
memcached_st *memc;
uint32_t&nbs ......
c指针的运算有时候还是很迷惑人的。
例如:
struct student {
int num;
int score;
int length;
};
struct student *pt;
pt = (struct student *) malloc(sizeof(struct student));
pt->num = 1;
pt->score = 90;
pt->length = 3 * sizeof(int);
printf("pt length:%d\n", *pt);
pt = (int ......
周五开会做团队成员codereivew, 有同事提出了一个关于gmtime多线程是否安全的问题, 当时觉得程序Link了VC的多线程库,应该不是问题。还好回头核实了一下,发现了竟是一个潜在的bug。
程序分在application(完成项目特定功能)和framework(可重用的核心功能)两部分,线程的启动由framework完成。 app中使用了gmtime/loc ......
1.内存分配方式
内存分配方式有三种:
[1]从静态存储区域分配。内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在。例如全局变量,static变量。
[2]在栈上创建。在执行函数时,函数内局部变量的存储单元都可以在栈上创建,函数执行结束时这些存储单元自动被释放。栈内存分配运算内置于 ......