打开文件 [英] Open File

查看:42
本文介绍了打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是一名学生正在使用C ++ builder进行项目。我有一个问题在

打开一些超过47的文件,当它运行它只创建46

文件时,请帮我创建任意数量的文件。谢谢

你的努力。

Mohd Klaib

例如:


FILE * out [100 ];

char filename [100];

int noFiles = 78;


for(int i = 0; i< noFiles; i ++)

{

sprintf(filename," c:/ test / TestSuite%d",i);

out [ i] = fopen(filename," wt");

}

Hi
I am a student doing a project using C++ builder. I hava a problem in
opening a number of files more than 47, when run it only it create 46
file, Please help me to be able to create any number of files. Thanks
to your efforts.
Mohd Klaib
Example :

FILE *out[100];
char filename[100];
int noFiles=78;

for (int i=0 ; i<noFiles ; i++)
{
sprintf (filename,"c:/test/TestSuite%d",i);
out[i]= fopen(filename, "wt");
}

推荐答案

mo ******* @ gmail.com 写道:



我是一名学生使用C ++ builder进行项目。我有一个问题在

打开一些超过47的文件,当它运行它只创建46

文件时,请帮我创建任意数量的文件。谢谢

你的努力。

Mohd Klaib

例如:


FILE * out [100 ];

char filename [100];

int noFiles = 78;


for(int i = 0; i< noFiles; i ++)

{

sprintf(filename," c:/ test / TestSuite%d",i);

out [ i] = fopen(filename," wt");

}
Hi
I am a student doing a project using C++ builder. I hava a problem in
opening a number of files more than 47, when run it only it create 46
file, Please help me to be able to create any number of files. Thanks
to your efforts.
Mohd Klaib
Example :

FILE *out[100];
char filename[100];
int noFiles=78;

for (int i=0 ; i<noFiles ; i++)
{
sprintf (filename,"c:/test/TestSuite%d",i);
out[i]= fopen(filename, "wt");
}



这看起来更像是C问题。


如果你打开了系统打开文件的数量

限制,你就无法做很多事情。你最好在平台上询问

特定群体。


-

Ian Collins。

This looks more like a C problem.

There isn''t a lot you can do if you have hit the number of open files
limit for your system. You would be better off asking on a platform
specific group.

--
Ian Collins.


mo*******@gmail.com 写道:



我是一名学生正在使用C ++ builder进行项目。我有一个问题在

打开一些超过47的文件,当它运行它只创建46

文件时,请帮我创建任意数量的文件。谢谢

你的努力。

Mohd Klaib

例如:


FILE * out [100 ];

char filename [100];

int noFiles = 78;


for(int i = 0; i< noFiles; i ++)

{

sprintf(filename," c:/ test / TestSuite%d",i);

out [ i] = fopen(文件名," wt");

}
Hi
I am a student doing a project using C++ builder. I hava a problem in
opening a number of files more than 47, when run it only it create 46
file, Please help me to be able to create any number of files. Thanks
to your efforts.
Mohd Klaib
Example :

FILE *out[100];
char filename[100];
int noFiles=78;

for (int i=0 ; i<noFiles ; i++)
{
sprintf (filename,"c:/test/TestSuite%d",i);
out[i]= fopen(filename, "wt");
}



你真的必须同时打开78个文件* ?这很难相信。我建议您一次操作一个文件,并在完成后关闭

。重组你的代码来做到这一点。


john

Do you really have to have 78 files open *simultaneously*? That''s hard
to believe. I suggest you operate on the files one at a time, and close
them when you are finished. Reorganise your code to do this.

john


5月28日上午9:00,John Harrison< john_androni。 .. @ hotmail.comwrote:
On May 28, 9:00 am, John Harrison <john_androni...@hotmail.comwrote:

mom.kl ... @ gmail.com写道:
mom.kl...@gmail.com wrote:


我是一名学生使用C ++ builder进行项目。我有一个问题在

打开一些超过47的文件,当它运行它只创建46

文件时,请帮我创建任意数量的文件。谢谢

你的努力。
I am a student doing a project using C++ builder. I hava a problem in
opening a number of files more than 47, when run it only it create 46
file, Please help me to be able to create any number of files. Thanks
to your efforts.


示例:
Example :


FILE * out [100];

char filename [100];

int noFiles = 78;
FILE *out[100];
char filename[100];
int noFiles=78;


for(int i = 0; i< noFiles; i ++)

{

sprintf(filename," c:/ test / TestSuite%d",i);

out [i] = fopen(filename," wt");

}
for (int i=0 ; i<noFiles ; i++)
{
sprintf (filename,"c:/test/TestSuite%d",i);
out[i]= fopen(filename, "wt");
}


你真的必须同时打开78个文件*吗?这很难相信。
Do you really have to have 78 files open *simultaneously*? That''s hard
to believe.



对于一个学生项目,也许,但没有什么特别的

非常的服务器有几百个文件打开/>
同时。

For a student project, maybe, but there''s nothing particularly
extraordinary for a server to have several hundred files open
simultaneously.


我建议您一次操作一个文件,并关闭

当你是完了。
I suggest you operate on the files one at a time, and close
them when you are finished.



这意味着打开每个请求的文件,并在请求结束时关闭
。哪会慢下来

相当大,并不一定有帮助,因为不同的

线程(不同的客户端连接)仍将访问

不同的文件。


-

James Kanze(GABI软件)电子邮件:ja ********* @ gmail.com

Conseils eninformatiqueorientéeobjet/

Beratung in objektorientierter Datenverarbeitung

9placeSémard,78210 St.-Cyr-l''coco,France,+ 33 (0)1 30 23 00 34

That would mean opening the files for each request, and closing
it at the end of the request. Which would slow things down
considerably, and wouldn''t necessarily help, since different
threads (different client connections) will still access
different files.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34


这篇关于打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆