Retrieve filename from file descriptor in C

Is it possible to get the filename of a file descriptor (Linux) in C?

How to compare 2 files fast using .NET?

Typical approaches recommend reading the binary via FileStream and comparing it byte-by-byte. Would a checksum comparison such as CRC be faster? Are there any .NET libraries that can generate a...

Determine path of the executing script

I have a script called foo.R that includes another script other.R, which is in the same directory: #!/usr/bin/env Rscript message("Hello") source("other.R") But I want R to find that other.R no...

Sort a file with huge volume of data given memory constraint

Points: We process thousands of flat files in a day, concurrently. Memory constraint is a major issue. We use thread for each file process. We don't sort by columns. Each line (record) in the...

Force git to add dotfiles to repository

How can I add files starting with dot (hidden files) in git repo? Git seems to always ignore those. When I type git add ., dotfiles in GIT_DIR are added, but not from subdirectories. On the other...

How to group files by date using PowerShell?

I have a folder with 2000+ files. I want to count the files by date. so with: Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- ...

HTML5 File API read as text and binary

I am currently working on the HTML5 File API, and I need to get binary file data. The FileReader's readAsText, and readAsDataURL methods work fine, but readAsBinaryString returns the same data as...

How to read a file line-by-line into a list?

How do I read every line of a file in Python and store each line as an element in a list? I want to read the file line by line and append each line to the end of the list.

Easiest way to check if an arbitrary String is a valid filename

In my application the user can enter a filename. Before processing I'd like to check if the input String is a valid filename on Windows Vista. Whats the easiest way to do that? By valid I'm...

How to delete a line from the file with php?

I have a file named $dir and a string named $line, I know that this string is a complete line of that file but I don't know its line number and I want to remove it from file, what should I do? Is...

Download a single folder or directory from a GitHub repo

How can I download only a specific folder or directory from a remote Git repo hosted on GitHub? Say the example GitHub repo lives here: [email protected]:foobar/Test.git Its directory...

Create a directory if it doesn't exist

In my app I want to copy a file to the other hard disk so this is my code: #include <windows.h> using namespace std; int main(int argc, char* argv[] ) { string Input = "C:\\Emploi...

Loading text file into listbox

What I am wanting to achieve is loading a text file into a listbox. It seems simple enough but I need to recognise in the text file when there is a new line, and each new line needs to be a new...

open() gives FileNotFoundError/IOError: Errno 2 No such file or directory

For some reason my code is having trouble opening a simple file: This is the code: file1 = open('recentlyUpdated.yaml') And the error is: IOError: [Errno 2] No such file or directory:...

Portable way to check if directory exists [Windows/Linux, C]

I would like to check if a given directory exists. I know how to do this on Windows: BOOL DirectoryExists(LPCTSTR szPath) { DWORD dwAttrib = GetFileAttributes(szPath); return (dwAttrib !=...

golang test temp directory

I have a simple function which parses a config file as JSON. I want to write a test which either uses some sample static config files and parses them, or creates the samples during the test and...

Get files from sub directory using vb.net

I have a directorry which contains many folders such as folder1,folder2,folder3 etc..which contains sub-directories..In that I have a folder name "special" which contains some files Now I would...

Python MultiThreading For Downloads

I need to download 2 diffrent files at the time. import urllib urllib.urlretrieve('http://example.com/test1.zip', "C:\Test\test1.zip") urllib.urlretrieve('http://example.com/test2.zip',...

Search a file in linux and jump to position of the first find

I need help with a linux command with which I can search for a string in a text file and go to the first position this string is found and being able to scroll down and up from there. I am looking...

copy files from one server to another using php

I have two similar websites.Some of the content are same in both sites.I have some files in specific folder in one website say A.I want to copy some specific files from Website A to website B. I...

Nginx node.js express download big files stop at 1.08GB

I have this node.js app proxied by Nginx (on production). A route is something like this: exports.download = function(req, res){ var id = req.params.id; if (id && id ==...

How to send and receive file with Java RabbitMQ?

How to send file with Java RabbitMQ? Especially using message converter. I'm using Spring Framework, can send String or ArrayList but can't send File. I'm only use convertAndSend and...

Read list of numbers in txt file and store to array C

I have a problem with reading the numbers. After I run the program everything is fine but there are no numbers in the array. I have tried different ways of writing the numbers in the file with no...

Python error message io.UnsupportedOperation: not readable

I made a simple program but It shows the following error when I run it: line1 = [] line1.append("xyz ") line1.append("abc") line1.append("mno") file = open("File.txt","w") for i in range(3): ...

How can I separate the functions of a class into multiple files?

I have a main class that has a ton of different functions in it. It's getting hard to manage. I'd like to be able to separate those functions into a separate file, but I'm finding it hard to come...

How to use magic bytes to identify files using python

I was given a problem that stated: We've extracted one of the alien zip files, it's a bunch of PNG files, but we think only one of them is valid. Use magic byte to determine which it is. Tip:...

How to import all Dart files from a Directory?

I am new to dart so please bear with me if this is really bad question. I am developing an app using flutter, and I have one question. I have many screens in my app, like About the App, Homepage,...

How to get Image from URL to a File in Flutter?

I have an image saved on Firebase Storage. How can I assign this URL of the image file to a File? Is there some way to do it as: File file = File(URL); I've also tried using http, but results in...

Laravel: Generate PDF of Blade View and Store it in specified folder

I have a Laravel Blade View, which is fetching data from Database. It is working perfectly. Here is my Controller: $model = new outbound_detail; $data = $model->where('reference',...

File.delete() & File.renameTo() Not Working in Project Environment

I am trying to create an authentication system of sorts that uses a file called Users.dat to store user data. Currently, I am developing a method to remove users by rewriting the Users.dat file,...