stat

How can i format the output of stat expression in Linux Gnome Terminal?

不羁的心 提交于 2020-01-04 17:29:07
问题 I am really newbie in Linux(Fedora-20) and I am trying to learn basics I have the following command echo "`stat -c "The file "%n" was modified on ""%y" *Des*`" This command returns me this output The file Desktop was modified on 2014-11-01 18:23:29.410148517 +0000 I want to format it as this: The file Desktop was modified on 2014-11-01 at 18:23 How can I do this? 回答1: You can't really do that with stat (unless you have a smart version of stat I'm not aware of). With date Very likely, your

How do you determine the optimal disk IO block size on Win32?

大憨熊 提交于 2020-01-04 13:31:10
问题 On Posix systems, the st_blksize member of the stat structure contains the optimal block size for IO for a given file. It looks like the Win32 implementations of stat (_stat & _stat64) do not support this field. What is the Win32 equivalent way of determining the optimal IO block size for a given file or filesystem? 回答1: I'm not sure if this will always return the optimal number, but the Win32 call GetDiskFreeSpace returns, among other things, lpBytesPerSector and lpSectorsPerCluster ;

How do you determine the optimal disk IO block size on Win32?

橙三吉。 提交于 2020-01-04 13:30:52
问题 On Posix systems, the st_blksize member of the stat structure contains the optimal block size for IO for a given file. It looks like the Win32 implementations of stat (_stat & _stat64) do not support this field. What is the Win32 equivalent way of determining the optimal IO block size for a given file or filesystem? 回答1: I'm not sure if this will always return the optimal number, but the Win32 call GetDiskFreeSpace returns, among other things, lpBytesPerSector and lpSectorsPerCluster ;

Static members in VB.NET

眉间皱痕 提交于 2020-01-03 15:53:05
问题 I used to write this: Private Sub Example() Static CachedPeople As List(Of MyApp.Person) If CachedPeople Is Nothing Then CachedPeople = New List(Of MyApp.Person) End If ...rest of code... End Sub But then wondered if I could reduce this to: Private Sub Example() Static CachedPeople As New List(Of MyApp.Person) ...rest of code... End Sub The question is, will the "New" bit only be executed once when the function is first executed but in the next call, it will already exist. Cheers, Rob. 回答1:

stat() unavailable in ios simulator?

拈花ヽ惹草 提交于 2019-12-31 05:16:12
问题 I've compiled and linked ios app that uses lib (libclang) that uses stat() with no errors. But i'm having runtime error: 2014-07-07 16:55:14.138 LibClangUsage7Demo[74938:60b] started Detected an attempt to call a symbol in system libraries that is not present on the iPhone: stat$INODE64 called from function _ZN4llvm3sys2fs6statusERKNS_5TwineERNS1_11file_statusE in image LibClangUsage7Demo. LLVM code which raises error is (/Unix/Path.inc): error_code status(const Twine &Path, file_status

How to print the name of the files inside an archive file?

泪湿孤枕 提交于 2019-12-25 05:37:21
问题 I'm new to C and system programming. I want to open an archive file and print out the name of the files inside the archive file (e.g., my archive file is weds.a; inside weds.a, I have thurs.txt and fri.txt". I want to create an output that shows thurs.txt fri.txt EDITED: It should work like the ar -t command. Can someone give me some tips on how to do it? I've been reading the man page and looking for examples online, but I'm getting no where. I believe I'm missing something. The code I have

Trying to calculate highest marks with name in python

◇◆丶佛笑我妖孽 提交于 2019-12-25 02:43:22
问题 grade=[] names=[] highest=0 cases=int(input('Enter number of cases: ')) for case in range(1,cases+1): print('case',case) number=int(input('Enter number of students: ')) for numbers in range (1,number+1): name=str(input('Enter name of student: ')) names.append(name) mark=float(input('Enter mark of student:')) grade.append(mark) print('Case',case,'result') print('name',list[list.index(max(grade))]) average=(sum(grade)/number) print('average',average) print('highest',max(grade)) print('name'

Ubuntu listing up files recursively, detecting sym-links

两盒软妹~` 提交于 2019-12-25 02:28:59
问题 I'm trying to list up my local file-system recursively using dirent.h . In order to prevent from following sym-links, I'm using the sys/stat.h header. In the following you can find my SSCCE program. /** * coding: utf-8 * * Copyright (C) 2013, Niklas Rosenstein * * listdir.c - List up directories and file-content recursively. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> void list_dir(const char* directory_name) { DIR* directory_handle

stat() returns error

夙愿已清 提交于 2019-12-24 22:46:34
问题 I have to know the modification date of some files in a folder. It works, but not with all types of files. For example it works with .c, .txt, but it doesn't work with other types such .mp4, .jpg and .mp3 (the application I'm creating have to work with multimedia files in general). It prints "Cannot display the time.", so I suppose the problem is on stat(). Thanks. This is the code: #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string.h> #include <time.h> #include <sys

Race condition with stat and mkdir in sequence

[亡魂溺海] 提交于 2019-12-24 06:51:25
问题 Coverity complains of . toctou: Calling function mkdir that uses DIR after a check function. This can cause a time-of-check, time-of-use race condition if (stat(DIR, &st) != 0) { if (mkdir(DIR, 0755) < 0) { return ERROR; } } Is it good enough to change the code to ,I was using stat only for file exist check if (mkdir(NDUID_DIR, 0755) < 0) { if(errno != EEXIST) { return ERROR; } } Is there a better way to fix the code? 回答1: Both of your snippets appear to be incorrect and/or incomplete. On