Questions tagged [stat]

The stat(2) system call on POSIX systems. For statistics, use the statistics instead.

The stat(2) system call is used to retrieve information about a named file (or directory).

Links:

For statistics, use the tag instead.

829 questions
0
votes
2 answers

C - having trouble using stat() to get bytes

char string[50], s[50]; struct stat buf; int counter = 0; while (fgets(string, sizeof string, stdin)) { if (strspn(string, "size ") == 5) { for (int i = 5; i < strlen(string); i++) { s[counter] = string[i]; …
Jordan
  • 2,070
  • 6
  • 24
  • 41
0
votes
1 answer

Formatting mtime from stat(system call)

So I'm writing a program to mimic the "find" command in linux. I have everything taken care of, but I cannot figure out how to format the string from ctime, mtime and atime. I know the arguments are struct time_t, but I can't find to convert it to a…
twsmale
  • 139
  • 1
  • 5
  • 14
0
votes
3 answers

stat() returns error

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…
phcaze
  • 1,707
  • 5
  • 27
  • 58
0
votes
1 answer

stat() in mingw works incorrectly

I created a simple code: int main(int argc, char *argv[]) { struct stat eStat; int result; struct stat eStat2; int result2; result = stat("g:/temp/dvd", &eStat); printf("result=%d | eStat.st_mode=%d | S_IFMT=%d |…
-1
votes
2 answers

wanna to read hdf file in dataframe

gss = pd.read_hdf('gss.hdf5', 'gs') this the code i have used on VS code. and i got this Traceback (most recent call last): File "d:\pthon_txt\t.py", line 4, in gss = pd.read_hdf('gss.hdf5', 'gs') …
-1
votes
1 answer

How to find stat (min, max, quantile, etc) of a list without using pandas.series?

I have a variable list of elements. I want to be able to find, count mean std min 25% 50% 75% max . I know I can use pandas.Series.describe(). However, I have a restriction that I cannot use pandas for the specific problem. Is there any built in…
Droid-Bird
  • 1,417
  • 5
  • 19
  • 43
-1
votes
1 answer

How to solve two balls select event without replacement

Q)A box contains 4 red balls, 3 green balls and 3 blue balls. Two balls are selected at random without replacement. Let X represent the number of red balls in the sample and Y the number of green balls in the sample. a) Arrange the different pairs…
-1
votes
1 answer

directory listing C (using dirent and stat)

Im making a directory listing application that prints a directory listing just like the ’ls’ and ’dir’ commands in Linux and Windows respec- tively. my function: prints a listing of all files in the directory specified by path. this is my code so…
bizariuz
  • 15
  • 3
-1
votes
1 answer

How to create a new variable in my data frame that expressed some of the data in the existing frame

So I have a data frame that expresses the relationship between year, wages, degree, gender, and age. For the year, there are 2015 and 1996. How do I create a new variable that only expressed the income belongs to the year 2015? Please help me, I am…
vitas
  • 1
-1
votes
1 answer

Calculation confidence intervals - Bootstap

I'm trying to calculate the confidence interval for a list with 1000 numbers and turn it into a tuple with two variables. however instead of getting a tuple with two variables, I get a tuple of two arrays containing 1000 intervals each. this is my…
ran bar
  • 75
  • 5
-1
votes
1 answer

searching for files with stat in /bin

hi im trying to write a code that will search for file in /bin directory and identify if the file actually exist, my code always turns ERROR and i don't really get why can you give me a clue? #include #include #include…
mxsgd
  • 11
  • 3
-1
votes
1 answer

How to plot multiple lines in ggplot2 with years on x and frequecy on y

I have a data frame that looks like this TYPE YEAR ARSON 2008 THEFT 2009 ARSON 2010 ASSAULT 2008 The data continue's with more types and the years are…
air bmx
  • 11
  • 1
  • 4
-1
votes
1 answer

stat work at the command line but not when passed into a variable

I am debugging a bash script (on ubuntu) to obtain an image file block size using stat. The result from stat is correct at the command line but not when passed into a variable (as it is in the script). If I use the stat command at the command line,…
MCC
  • 109
  • 1
  • 5
-1
votes
1 answer

How can I get the stat in linux?

I'm working in Linux and C, and I am trying to get the specific values from stat. In /proc when I do stat I get multiple values returned. Now I'm trying to do this like below: thisFile = fopen("/proc/stat","r"); and print the individual User,…
tejosa
  • 135
  • 2
  • 11
-1
votes
2 answers

Segmentation fault (core dumped) using stat (st_uid)

I would like to write a simple C script in UNIX that will work like "ls -l". I have a working part where the script lists all of the files in the current directory: #include #include #include #include…
BloodyMary
  • 173
  • 13