如何使用C语言获取文件名 [英] How to get filename using C language

查看:1496
本文介绍了如何使用C语言获取文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想通过C语言从文件夹中获取文件名。

例如,在路径/ Users / abc /中Desktop / xyz /有一个名为

" test.s"的文件。 (文件test.s在文件夹xyz内)。我应该如何在C中编写一个

例程来获取文件名test.s。 ?非常感谢。

Hi,

I would like to get the filename from a folder by using C language.
For example, in path /Users/abc/Desktop/xyz/ there is a file named
"test.s" (file "test.s" is inside folder "xyz"). How should I write a
routine in C to get the file name "test.s" ? Thanks a lot.

推荐答案

Hughes< hu ******* @ hotmail.com>潦草地写道:
Hughes <hu*******@hotmail.com> scribbled the following:

我想通过使用C语言从文件夹中获取文件名。
例如,在path / Users / abc / Desktop / xyz中/有一个名为
test.s的文件。 (文件test.s在文件夹xyz内)。我应该如何在C中编写一个
例程来获取文件名test.s。 ?非常感谢。
Hi, I would like to get the filename from a folder by using C language.
For example, in path /Users/abc/Desktop/xyz/ there is a file named
"test.s" (file "test.s" is inside folder "xyz"). How should I write a
routine in C to get the file name "test.s" ? Thanks a lot.




你不能用ISO标准C来做。请在系统特定的
新闻组中询问。谢谢。


-

/ - Joona Palaste(pa*****@cc.helsinki.fi)------- ------芬兰-------- \

\-- http://www.helsinki.fi/~palaste ---------------------规则! -------- /

你可以夺走他的生命......

- Mirja Tolsa



You can''t do that in ISO standard C. Please ask in a system-specific
newsgroup. Thanks.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"You could take his life and..."
- Mirja Tolsa


您是否打算获取文件列表(特​​定于系统)或只是

从路径中提取文件名(例如,从字符串中获取test.s
" /Users/abc/Desktop/xyz/test.s")?


" Hughes" <胡******* @ hotmail.com>在消息中写道

news:49 ************************** @ posting.google.c om ...
Did you intend to get a list of files (which is system specific) or just
extract the filename from the path (e.g., get test.s from the string
"/Users/abc/Desktop/xyz/test.s")?

"Hughes" <hu*******@hotmail.com> wrote in message
news:49**************************@posting.google.c om...


我想通过使用C语言从文件夹中获取文件名。
例如,在路径/ Users / abc / Desktop / xyz中/有一个名为
test.s的文件。 (文件test.s在文件夹xyz内)。我应该如何在C中编写一个
例程来获取文件名test.s。 ?非常感谢。
Hi,

I would like to get the filename from a folder by using C language.
For example, in path /Users/abc/Desktop/xyz/ there is a file named
"test.s" (file "test.s" is inside folder "xyz"). How should I write a
routine in C to get the file name "test.s" ? Thanks a lot.



Hughes< hu ******* @ hotmail.com>写道:
Hughes <hu*******@hotmail.com> wrote:
我想通过使用C语言从文件夹中获取文件名。
I would like to get the filename from a folder by using C language.




C既不知道文件,也不知道文件夹。您必须使用

操作系统特定功能。

Flo

-

给我大约10秒钟想一下。

Florian Weingarten /使用PGP! (0x65C91285)



C does neither know about files, nor about folders. You have to use
operating system specific functions.
Flo
--
Give me about 10 seconds to think for a minute.
Florian Weingarten / Use PGP! (0x65C91285)


这篇关于如何使用C语言获取文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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