Questions tagged [file-handling]

file-handling is an abstraction of common actions such as creating, opening, closing, reading, updating, writing, comparing and deleting files

2915 questions
3
votes
2 answers

Perl: Please explain to me the following behaviours of while()

1.Why does while (<$filehandle>) iterate through a file seemlessly, but it doesn't iterate through lists or arrays without manipulating the array itself (like using while ($_ = shift @array){print $_}? How does this happen? 2.How is it that while…
steelmonkey
  • 415
  • 2
  • 6
  • 19
3
votes
1 answer

Database or File-Handling

To put a lot of searchable text in a software, what would be the best method, database or File-Handling system? Keeping in mind that the text is an Asian language with right-to-left orientation. Platform is Windows and Android.
Refromu
  • 33
  • 4
3
votes
1 answer

Why Executable and Linkable Format(ELF) File contains set of sections?

These-days I'm referring File Handling System Calls in Linux. Furthermore I understood ELF which is Executable and Linkable Format , contains set of sections. Those are .bss , .data , .rodata , .text , .comment , and unknown I referred Wikipedia…
Kelum
  • 1,745
  • 5
  • 24
  • 45
3
votes
4 answers

Perl: opening a file, and saving it under a different name after editing

I'm trying to write a configuration script. For each customer, it will ask for variables, and then write several text files. But each text file needs to be used more than once, so it can't overwrite them. I'd prefer it read from each file, made the…
Soop
  • 345
  • 5
  • 19
3
votes
1 answer

Seeking to middle of file in python

I'm writing a program to search for a specific line in a very large (unordered) file (so it would be preferred not to load the entire file into memory). I'm implementing multi threading to speed up the process. I'm trying to give a particular…
Grim Reaper
  • 550
  • 1
  • 5
  • 18
3
votes
2 answers

C programming, getting the last line of file

I am writing a c program that opens a txt file and want to read the last line of the txt file. I am not that proficient in C so bear in mind that I may not know all of the concepts in C. I am stuck at the part where I use fscanf to read all the…
GhostMember
  • 91
  • 1
  • 2
  • 9
3
votes
2 answers

Ruby cannot open file ( Errno::ENOENT ) but the same path can be opened from IRB

I have a simple Ruby script that is building a list of files from an array of strings, so I have a method a bit like this: def initialize( rootpath, name ) @content = "" intermission = "" if ( ! (rootpath[-1] == "/" || name[0] == "/"…
glenatron
  • 11,018
  • 13
  • 64
  • 112
3
votes
2 answers

Gtk+ File handling with C

Does anyone know file handling using GTK. I need to open a file in "w+" mode and write to it. I dont know if file handling exists in GTK. Below is a sample 'C' program that I need in GTK format. #include int main(int argc, char *argv[])…
AhmetHani
  • 33
  • 3
3
votes
2 answers

Segmentation fault with Image::ValidJpeg and in-memory files

I am experiencing an error Segmentation fault using the following Perl code: use LWP::UserAgent; use HTTP::Request; use HTTP::Response; use Image::ValidJpeg; my $url = ... my $ua = LWP::UserAgent->new(agent => ''); my $request =…
Ωmega
  • 42,614
  • 34
  • 134
  • 203
3
votes
2 answers

Print other language character in csv using perl file handling

I am scraping a site based on German language , I am trying to store the content of the site in a CSV using Perl , but i am facing garbage value in the csv, the code i use is open my $fh, '>> :encoding(UTF-8)', 'output.csv'; print {$fh}…
Bala
  • 73
  • 5
3
votes
1 answer

Rewrite existing xls files using Perl

I am trying to write data in excel files which is already exists, but the code I tried is creating a new sheet and erasing the old sheet with the data. This the code I use #!/usr/bin/perl –w use strict; use Spreadsheet::WriteExcel; # Create a new…
Bala
  • 73
  • 5
3
votes
1 answer

File never gets created

Im trying to write and execute a .vbs file with python. When I run the program, the IDE shows an error that the file I tried to make isn't there, so therefore it couldn't be executed. I followed exactly the documentation in python.org and other…
verymessi
  • 117
  • 1
  • 12
3
votes
5 answers

Put comma in txt file using file handling function

here is my code my names.txt file data is like this saad Alex Ashmil Shumail Fredrik all i want that to put a qoma after each name…
saad
  • 581
  • 1
  • 6
  • 11
3
votes
1 answer

Sending large files (~ 1GB) fails with SocketException

I'm trying to send large files using socket programming in java for a p2p file sharing application. This code is sending 200-300 mb files without any problems, but for large files around 1 gb it is giving the error:- java.net.SocketException:…
3
votes
3 answers

error checking pipe commands made in python for unix

I am compiling a command to be executed on a unix system from python, containing multiple piping step. e.g.: grep foo myfile | cmd1 | cmd2 > output These correspond to a series of transformations on entries that have foo in them from myfile. I…
user248237