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
0
votes
0 answers

read from second line from a binary file C++

I have a file containing A heading followed by the encrypted data. I need to ignore the 1st line (heading ) and read the rest of the file and then decrypt. I am doing this in C++. How do i go about it. I have tried getLine, but doesnt seem to work
0
votes
0 answers

Python Wait until files are written completely and then Zip them

I am writing a script currently to write 1hr-data into 4 files with the same name(i.e., timestamp). When I do not zip them File1: 1609306077 and File2: 1609309671. When the Zip function is not applied, the files are written individually and…
0
votes
1 answer

how to display records sorted according to roll no in c++ .dat file

This is all my code I want to sort the records when display all students using option 2 in the main menu this code returning me the data as it was saved means unsorted. #include #include #include #include using…
user10309793
0
votes
2 answers

Is there a way to Remove/Update a line at somewhere in the middle of a large text file in Python?

I want to do this without loading the entire file into memory or creating an alternate text file. The text file is very large. So it doesn't make sense to load the entire file into memory. Creating a new file(even for temporary purposes) is also not…
Faihan
  • 113
  • 1
  • 9
0
votes
1 answer

How can I save different types of objects into a single file and read them as needed?

class Room{ public: int price; char type[20]; int roomNum; int floor_num; bool status; //reserved = true, not reserved = false Room() : price(0) , status(false){ strcpy(type,""); …
Suwaid Aslam
  • 40
  • 1
  • 8
0
votes
1 answer

How to make multiple copies of a unique file resulting in different files names

I have one unique file "C:\Users\alexa\Desktop\EXTRACT\BON_B000.IMG.5.3.txt" and now I need to copy this file in more than 400 files with unique names, with exactly the same content but with different names. The file names do not have any order or…
sm0ke
  • 11
  • 2
0
votes
1 answer

File Handling in C Print out the reverse String in the output from the input

Okay, so i have a lot of problems with file handling and strings in C. The point of this task is to reverse the string from the output and to convert lower letters to upper and vice-versa. For example i have to get an output of ENALPOREa from an…
0
votes
1 answer

Using your own venv in other system

I am having 3 small problems which are inter-related. 1.I recently created my own virtual environment ,I want to export that environment to my friend's system so that he can run my environment's main program in one tap. 2.Also where to put main…
Avishkaar
  • 1
  • 1
0
votes
1 answer

RandomAccessFile writechar method writing NULto file and writeUTF writing ENQ , how to get ridoff those?

In java.io.RandomAccessFile , when the method writeChar() is used to write a char array in loop to a Text file as RandomAccessFile txtfile = new RandomAccessFile("Hello.txt","rw"); char c[] = {'S','i','g','n','e','d'}; for(char k:c)…
0
votes
1 answer

How to add columns in the starting position of a csv file in python?

I have a python program that converts csv files to '^' delimiter files. The output files also has new headers. cc = input("Enter Code \t") cn = input("Enter Item Number \t") input_file = input("Enter input file \t") act = input("Enter Action…
Atom Store
  • 961
  • 1
  • 11
  • 35
0
votes
1 answer

Delete database table based on the file names in Java

I have below code for class IImporter which is working fine till now. I received many zip files everyday which contains name as 'EQUFULLFILE' and 'NONEQUFULLFILE' in a directory and i am trying to read files from this directory and process it in…
Symonds
  • 184
  • 1
  • 2
  • 15
0
votes
0 answers

How to write lines to a file in java while the script is executing

I am trying to write strings to a file but all the strings are being written to the file once the script is terminated. To make my problem clear, in the below code I want to write a single string to my files per second and my file should be updated…
DrDoggo
  • 149
  • 10
0
votes
2 answers

How to seek write pointer in append mode?

I am trying to open a file read it's content and write to it by using the contents that were read earlier. I am opening the file in 'a+' mode. I can't use 'r+' mode since it won't create a file if it doesn't exist.
TheWhiteFang
  • 745
  • 5
  • 16
0
votes
1 answer

Why is my program reading an extra entry from a file in C++?

I have a file named 1.txt, it contains 3 lines, each line is stored in an object of class entry as follows: 1* 10/12/2020 5:30 a 11:15 p 0 0 0 0 ----- 2* 11/12/2020 3:45 a 5:46 a 0 0 0 0 ----- 3* 12/12/2020 5:46 a 4:56 p 34.6 0 0 0 blah and I'm…
0
votes
1 answer

Include declaration but not definition in main file C++

When using multiple files in C++, for example: main.cpp, definition.cpp, declaration.h // declaration.h int Myfunc(); //definition.cpp #include "declaration.h" int MyFunc() {return 5;}; // main.cpp #include #include…
Viktor Skarve
  • 129
  • 1
  • 8