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
-1
votes
2 answers

correlation of several columns need to be calculated

I'm trying to get the correlation coefficient for corresponding columns of two csv files. I simply use the followings but get errors. consider each csv file has 50 columns first values <- read.csv("") second values <- read.csv("") …
Jack
  • 165
  • 2
  • 12
-1
votes
1 answer

How can I implement functionality like the program which?

I'd like to find if the program less is installed on the system. I'm not allowed to use a direct system("which less") because of my requirements. So I'm going to try the PATHs in the PATH variable and do stat on the files to see if less is…
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
-1
votes
2 answers

Confused about how struct works in this piece of code

I was looking at piece of code here that I was gonna use: #include struct stat sb; if (stat(pathname, &sb) == 0 && S_ISDIR(sb.st_mode)) { ...it is a directory... } I suppose that if I'm going to use it, I should probably…
Steve Jobs
  • 181
  • 5
-1
votes
1 answer

How to change/fake the 'file size' on the fly in C code

I am working on user level filesystem using FUSE and my requirement is that : When I issue read for File A, I want to superimpose the contents of another file (say File B) and present the contents of File B as File A's contents. I have already…
Rohan
  • 47
  • 3
  • 9
-1
votes
1 answer

stat to get the size of a file and copy it

For one of my homework, I have to read a file (~100 lines). To manipulate the content of the file and extract all the lines, I allocate a buffer with the size of the file with the function stat. And I read the file with the function read with this…
bandera
  • 49
  • 9
-1
votes
1 answer

Error with C program that is meant to print out path to a given file

I am having trouble with my C program that is meant to print out the path to a given file from the root. Examples: ./pathto /users/cs/a1066199/ ./pathto . /users/cs/a1066199/ ./pathto file.txt /users/cs/a1066199/file.txt ./pathto…
-1
votes
1 answer

Printing an off_t

I have a problem with my C code. It prints, but way too many characters. The code: #include #include #include #include #include #include
-1
votes
2 answers

JS divergence between two discrete probability distributions of unequal length

I am implementing an online topic modeling as outlined in the paper - On-line Trend Analysis with Topic Models: #twitter trends detection topic model online I need to find the Jensen-Shannon divergence measure between the word distribution of each…
tan
  • 1,569
  • 5
  • 14
  • 30
-1
votes
2 answers

stat gives No such file or directory

I have the following code in C. I run it at FreeBSD. I compile it as cc -o bbb bb.c. Then run and get the output $ ./bbb -1 stat: No such file or directory This is the Code: #include #include #include #include…
Alexandr
  • 33
  • 6
-1
votes
2 answers

PHP - How to detect if i'm growing or not?

I create a website, i would like to know when i'm growing. The idea is, i have a table ID, USERNAME, PASSWORD, STAMP I would like to check, if yesterday i got a lot of new users than before yesterday, that means i'm growing, if before yesterday i…
Mafitsi
  • 97
  • 1
  • 1
  • 3
-1
votes
2 answers

Getting variable uninitialized in Perl using stat

I'm working on a script which shows the age of an existing file and then automatically delete it after about 4 hours of being there (presumed maintenance window). I've been trying to test my output with the stat function in Perl. We have multiple…
-1
votes
1 answer

Python: Windows System File

In python, how can I identify a file that is a "window system file". From the command line I can do this with the following command: ATTRIB "c:\file_path_name.txt" If the return has the "S" character, then it's a windows system file. I cannot…
stev
  • 1
  • 1
  • 3
-1
votes
1 answer

stat() doesn't find a file in c++

on Linux 12.04 I have an executable file located in say: /a/b/exe and a config file on /a/b/config when doing: cd /a/b/ ./exe everything's ok and the stat function finds the file config on /a/b/ HOWEVER,when running from root /a/b/exe the stat…
Alon_T
  • 1,430
  • 4
  • 26
  • 47
-1
votes
1 answer

MS Residual functions in R

Is there a pre-defined function to find Mean Square Residual (MS Residual) in the R programming language? Thanks.
user182078
  • 63
  • 2
  • 7
-2
votes
1 answer

How to parse linux stat command output with regex?

I'm struggling a couple of hours already. I can't do regex and never could. I need to capture the file name, size, type, user, group, access, modified and created with preg_match (PHP) for later usage. I know it's simple. I just can't do it. Any…
tenev
  • 1
  • 1