Questions tagged [file]

A block of arbitrary information, or resource for storing information, accessible by the string-based name or path. Files are available to computer programs and are usually based on some kind of persistent storage.

A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished. Computer files can be considered as the modern counterpart of paper documents which traditionally are kept in offices' and libraries' files, and this is the source of the term.

In modern computer architectures, files are organized in a tree structure. On the top, you have a root like C:\ in systems. There are several subfolders (inner nodes) below the root, e.g. Program Files or Users. The computer files, which contain the data, are the leaves of that tree.

On based systems, many types of system information are also represented as files, in filesystems such as sysfs and devfs, even though they don't represent information on a durable storage medium.


References


Related

, , , , ,

81192 questions
20
votes
11 answers

How to sort file names in ascending order?

I have a set of files in a folder, and all of them starting with a similar name, except one. Here is an example: Coordinate.txt Spectrum_1.txt Spectrum_2.txt Spectrum_3.txt . . . Spectrum_11235 I am able to list all the files from the specified…
novicegeek
  • 773
  • 2
  • 9
  • 29
20
votes
4 answers

Why is fwrite writing more than I tell it to?

FILE *out=fopen64("text.txt","w+"); unsigned int write; char *outbuf=new char[write]; //fill outbuf printf("%i\n",ftello64(out)); fwrite(outbuf,sizeof(char),write,out); printf("%i\n",write); printf("%i\n",ftello64(out)); output: 0 25755 25868 what…
zacaj
  • 1,987
  • 1
  • 19
  • 39
20
votes
7 answers

Search File And Find Exact Match And Print Line?

I searched around but i couldn't find any post to help me fix this problem, I found similar but i couldn't find any thing addressing this alone anyway. Here's the the problem I have, I'm trying to have a python script search a text file, the text…
Robots
  • 201
  • 1
  • 2
  • 4
20
votes
8 answers

Get the query string on the called javascript file

Is it possible to get the query parameters with javascript on the called javascript file like this: // in html // in file.js console.log(this.location.query) Is this possible somehow, or I have to use…
Adam Halasz
  • 57,421
  • 66
  • 149
  • 213
20
votes
4 answers

Implementing the ls -al command in C

As a part of an assignment from one of my classes, I have to write a program in C to duplicate the results of the ls -al command. I have read up on the necessary materials but I am still not getting the right output. Here is my code so far, its only…
ankur3000
  • 203
  • 1
  • 2
  • 5
20
votes
8 answers

How to get the internal and external sdcard path in android

Most of the new android devices have an internal sdcard and an external sdcard. I want to make a file explorer app but I can't find out how to get the path to use in my app because File file = Environment.getExternalStorageDirectory(); just…
Mahmoud Jorban
  • 952
  • 4
  • 13
  • 25
20
votes
1 answer

ffmpeg: which file formats support stdin usage?

I know ffmpeg is able to read data from stdin rather than reading from disk using ffmpeg -i -. Is this supported for all file formats? If it is not, is there a list which file formats are supported?
The Wavelength
  • 2,836
  • 2
  • 25
  • 44
20
votes
4 answers

How to write and read a file with a HashMap?

I have a HashMap with two Strings Map ldapContent = new HashMap. Now I want to save the Map in an external file to use the Map later without initializing it again... So how must I save the Map to use it later again?
user1671245
20
votes
5 answers

Creating a new file, filename contains loop variable, python

I want to run a function over a loop and I want to store the outputs in different files, such that the filename contains the loop variable. Here is an example for i in xrange(10): f = open("file_i.dat",'w') f.write(str(func(i)) …
lovespeed
  • 4,835
  • 15
  • 41
  • 54
20
votes
3 answers

How to read file attributes in a directory?

For example: import os print(os.listdir("path/to/dir")) will list files in a directory. How do I get the file modification time for all files in the directory?
Bdfy
  • 23,141
  • 55
  • 131
  • 179
20
votes
3 answers

Java File - Open A File And Write To It

I know we are supposed to add a snipit of code to our questions, but I am seriously dumbfounded and can't wrap my head or find any examples to follow from. Basically I want to open file C:\A.txt , which already has contents in it, and write a…
RedHatcc
  • 3,016
  • 4
  • 16
  • 13
20
votes
2 answers

Can I set the umask for tempfile.NamedTemporaryFile in python?

In Python (tried this in 2.7 and below) it looks like a file created using tempfile.NamedTemporaryFile doesn't seem to obey the umask directive: import os, tempfile os.umask(022) f1 = open ("goodfile", "w") f2 =…
shreddd
  • 10,975
  • 9
  • 33
  • 34
20
votes
4 answers

Differentiate between a unix directory and file in C and C++

Given a path, say, /home/shree/path/def, I would want to determine if def is a directory or a file. Is there a way of achieving this in C or C++ code?
Shree
  • 4,627
  • 6
  • 37
  • 49
20
votes
3 answers

How to accept bluetooth received file in Android application?

I would like to implement an application to receive a file from a Bluetooth device. Before receiving, a notification will be raised to accept an incoming file request. From there, i would like to activate "accept" and download the file automatically…
prasad.gai
  • 2,977
  • 10
  • 58
  • 93
19
votes
4 answers

How do I write a byte array to a file in Android?

This is my code to create a file. public void writeToFile(byte[] array) { try { String path = "/data/data/lalallalaa.txt"; FileOutputStream stream = new FileOutputStream(path); stream.write(array); } catch…
EGHDK
  • 17,818
  • 45
  • 129
  • 204
1 2 3
99
100