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

Fastest way of reading large object-text file

I store over 40,000 objects into a text file. My problem is reading all objects from text file is too slow. It even takes 4349 ms for 1,000 objects-text file. This is reading objects from text file. long startR = System.currentTimeMillis(); try{ …
Yu Wai Hlaing
  • 141
  • 1
  • 10
3
votes
3 answers

Error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'const std::ofstream' (or there is no acceptable conversion)

I am working on an MFC Application and have declared an ofstream object in a class header, the object is then initialized in the constructor and used in the other methods of the same class. I got the following error: Error C2678: binary '<<' : no…
Itban Saeed
  • 1,660
  • 5
  • 25
  • 38
3
votes
1 answer

How to Write File in Reverse Order

I'm working on an ANSI C application that produces file contents in reverse order. That is, the bytes at the end of the file are received first, and those at the beginning are received last. Preferably, due to the amounts of data that may be…
Jim Fell
  • 13,750
  • 36
  • 127
  • 202
3
votes
2 answers

perl - file handling

I have a list of files on host machine say in directory /src/. The directory has more subdirectories. now this directory is copied onto remote machine after mounting. Now the files are preset in remote machine in directory /dst. Example. If I had…
Anu
  • 525
  • 1
  • 6
  • 18
3
votes
1 answer

How to create a file in remote host along with the creation of directory using ssh

I have a file say /a/b/c/file in my host. I want to create a file on remote host in directory say dest. Now the question is, how do I create a file in remote host as /dest/a/b/c/d/file using perl script and using ssh. Any idea how do I create…
Anu
  • 525
  • 1
  • 6
  • 18
3
votes
1 answer

How to call a system file selection dialog using perl on windows?

I know many perl based gui module would do that easily but I am curious about methods other than Prima or Tk etc. I want to call this dialog (Exactly looking as Windows Explorer) for a command line package. Is anything similar to system(''); command…
3
votes
1 answer

Difference between '>>' and '>' in Perl

What is the difference between these two code snippets? open (MYFILE, '>>data.txt'); open (MYFILE, '>data.txt');
Karandeep Singh
  • 1,223
  • 5
  • 22
  • 34
3
votes
1 answer

How to check file exists is case insensitive

I want to check if a file exist in Perl. This can be done using (-e $filename). But this is case sensitive. How can I check for case insensitive. I have to use only core package to achieve this.
Omkar
  • 51
  • 5
3
votes
1 answer

Why does tellp() return 0 for ios::app but not for ios::ate?

I have the following code snippet : ofile.open("New1.dat",ios::app|ios::binary|ios::ate); long bytes = ofile.tellp()/sizeof(t); cout<
Ayushi Jha
  • 4,003
  • 3
  • 26
  • 43
3
votes
2 answers

I've created a recipe program for GCSE Computing, but I am missing one step

This is my first post here and I am quite unsure on how to implement a vital piece of code in my coursework. I have created a very crude and basic recipe program on Python 3.4. Below is the piece I am missing. • The program should ask the user to…
3
votes
2 answers

Force an OleDbConnection to Release a File Handle

Related Question My code doesn't release a file handle even after I call dispose to an initialized OleDbException. Is there a way to explicitly force the program to release a file handle?
Jonn
  • 4,599
  • 9
  • 48
  • 68
3
votes
2 answers

Seek function not working in perl

I tried the below code snippet and the seek function doesn't seem to work. funct("ls -ltr /scratch/dummy/dum*"); sub funct { print "\nRecording\n"; open(SENSOR_LIST1, "$_[0] |") || die "Failed to read sensor list: $!\n"; for $sensor_line1…
Helloworld
  • 43
  • 5
3
votes
5 answers

java : File.getAbsoluteFile().exists() v/s File.exists()

I want to check the Folder Existance before creating the new one. For that which method I need to use : File folder = new File(PATH); there are two method for checking the same 1) folder.getAbsoluteFile().exists() OR 2) folder.exists() Which…
mcacorner
  • 1,304
  • 3
  • 22
  • 45
3
votes
2 answers

deleting a record in binary mode without creating a temp file (C file I/O)

All the codes so far I referred uses temp file to delete a record from file. Ex: fp=fopen(“foo.db”,”rb”); ft=fopen(“temp.db”,”wb”); //check both files opened or created successfully. Terminate program accordingly…
Sagar
  • 228
  • 1
  • 17
3
votes
5 answers

feof() in C file handling

I am reading a binary file byte-by-byte,i need determine that whether or not eof has reached. feof() doesn't works as "eof is set only when a read request for non-existent byte is made". So, I can have my custom check_eof like: if (…
sud03r
  • 19,109
  • 16
  • 77
  • 96