#include<stdio.h>
#include<string.h>
intmain(intargc,char*argv[]){
char*FileDP=argv[0];
printf("%s ",FileDP);
char*FileName=strrchr(FileDP,'\')+1;
printf("%s ",FileName);//Here'sFileName.
}
2. 用批处理命令获取文件夹名称
1、在电脑中新建一个文本文档,双击打开该文档。
3. 怎样用vb获取exe自身的文件名
Dim str As String
str = IIf(Len(App.Path) > 3, App.Path & "\" & App.EXEName & ".exe", App.Path & App.EXEName & ".exe") str 就是EXE文件的路径了。搞这么复杂是因为当EXE文件在根目录下的时候,app.path 是带有“\”,不在根目录下的时候没有。
4. c#如何获取当前运行程序的文件名
string strFullPath = Application.ExecutablePath;
string strFileName = System.IO.Path.GetFileName ( strFullPath );
5. 怎样用fortran获取一个文件夹里的所有文件名
天河流纹石,回答的答案挺好,但是有bug。
网页链接这个链接就是他答案的来源,按照帖子说明,测试基本成功,稍有问题。其中bug怎么解决,刚刚给回了帖子。
再次感谢
zxcvbno
为了后来者用起来方便,把完整消除bug的代码如下所示。
! get_file_name.f90
! functions:
! get_file_name - entry point of console application.
!
!****************************************************************************
!
! program: get_file_name
!
! purpose: entry point for the console application.
!
!****************************************************************************
program get_file_name
implicit none
external writename
integer :: n
call dowithwildcard( '*.*' , writename , n )
if ( n >= 0 ) then
write(*,*) '共' , n , '个文件!'
end if
end program get_file_name
subroutine dowithwildcard(cwildcard,callback,itotal)
use dflib,only:getfileinfoqq,getlasterrorqq,file$info,file$last,file$error,file$first,err$nomem,err$noent,file$dir
implicit none
interface
subroutine callback( filename , loop )
character(*),intent(in) :: filename
integer,intent(in) :: loop
end subroutine callback
end interface
character*(*),intent(in)::cwildcard
integer,intent(out)::itotal
type (file$info) info
integer(4)::wildhandle,length,retint
character(100) :: lastname
wildhandle = file$first
itotal = 0
do while (.true.)
length = getfileinfoqq(cwildcard,info,wildhandle)
if ((wildhandle .eq. file$last) .or.(wildhandle .eq. file$error)) then
select case (getlasterrorqq())
case (err$nomem) !//内存不足
itotal = - 1
return
return
itotal = 0
return
end select
end if
if ((info%permit.and.file$dir).eq.0) then
if(trim(info.name) .eq. trim(lastname)) return
lastname = trim(info.name)
call callback( trim(info.name) , itotal + 1 )
itotal = itotal + 1
end if
end do
end subroutine dowithwildcard
subroutine writename( filename , loop )
character(*),intent(in) :: filename
integer,intent(in) :: loop
write(*,*) loop , filename
end subroutine writename
6. 客户端winform程序获取服务器指定路径下所有文件名,能直接下载过来更好,服务器运行.ASP程序
winform是CS结构。所以说像这样的程序你必须要用个服务端。当然哪如果你是用FTP的话就可以不要了。但服务器上必须开启ftp服务来响应你的客户端要求FTP的就不讲了。你上网查个FTP的例子就可以了。如果是自己搞服务端可以用远程对象来实现意思就是这个类在服务端实例一个出来专门用于执行的。客户端只要调用就行了。结果会返回给客户端的。如果你要样例请给我你的QQ。我好发给你