file-handling is an abstraction of common actions such as creating, opening, closing, reading, updating, writing, comparing and deleting files
Questions tagged [file-handling]
2915 questions
0
votes
2 answers
My program makes a new file but with the wrong name. How do I fix this?
import os.path
def start():
if os.path.exists("new.txt") == False:
Account = input('Username: ')
Password_for_account = input('Password: ')
all_the_content = []
all_the_content.append(Account)
…

Samrath Chadha
- 3
- 5
0
votes
1 answer
Edit a text file in c#, the file happens to be an Illustrator (.ai) file
We have hundreds of Illustrator files that use a font that needs to be changed. I can open the Illustrator file in Notepad++, search for the font in question and replace it with the new font. The file then opens without issue in Illustrator using…

Jimmy Scrambles
- 11
- 3
0
votes
0 answers
How can I use files to store my data and access it when it is re-run(in python)?
def new_pass():
User_new = input('Enter Username: ')
Pass_new = input('Enter Password: ')
output_final = User_new + ' ' + Pass_new
with open('new.txt', 'w') as new_folder:
new_folder.write(output_final)
return…

Samrath
- 29
- 1
- 1
- 6
0
votes
1 answer
Printing a string from a file that was read using fread() is not working properly
I am a beginner in C language and I'm trying to learn about file handling with functions such as fread() and fwrite(), but there is a problem when I read a string from a file and output it using printf("%s", var); this is the program below to test…

Vinícius Godoy
- 23
- 7
0
votes
0 answers
How to search for a string and display of the particular string stored in txt file?
The project that I am working on is an income and expense system where there will be three options:
Add income and expense of a month
Search income and expense by month
Display the report of a year
For the first one, I asked the user to input the…

louis drama
- 3
- 2
0
votes
1 answer
How to create a folder of current date and time And copy some other folder in that recently made folder in python
I have tried it in Jetbrains Pycharm but it is showing an error.
Here is my code
from datetime import datetime
import os
import shutil
now = datetime.now()
dt=now.strftime("%d%m%Y…
0
votes
1 answer
Error:- '_io.TextIOWrapper' object is not callable
I have written a code to find the roots of an equation by bisection method.
I am trying to append my loop index and the difference between two solutions every iteration of the loop, but I am getting the error mentioned in the title of the…

Shashank Saumya
- 11
- 2
0
votes
2 answers
How does read and write function work in C++ file handling?
I'm learning file handling in c++ from internet alone. I came across the read and write function. But the parameters they take confused me.
So, I found the syntax as
fstream fout;
fout.write( (char *) &obj, sizeof(obj) );
and
fstream fin;
fin.read(…

Rajaram Karki
- 13
- 6
0
votes
2 answers
How does a BufferedReader's read(char[]) work?
I was searching on the internet and came across this code to read files from a file and convert it into a string. But I don't understand how in.read(arr) is reading all the contents of a file at once.
import java.util.Scanner;
import…

Robin
- 3
- 2
0
votes
0 answers
Storing file in chunks(in binary format) and retrieving it using c
I am trying to implement a distributed file system and for that I have to read files in chunks (files can be of any type image, audio, video, text, etc).
`typedef struct chunk_structure{
int chunk_id;
int is_last;
char file_name[100];
char…

Sunil Kumar Jha
- 841
- 1
- 8
- 11
0
votes
1 answer
problem in appending multiple records in a file
I am having problem with appending more records to this file. It allows me add just one record but I cannot add more than one record. And cannot figure out what is going wrong with it?
void new_customer()
{
char ch;
int flag=0;
FILE…

Mohsin Khan
- 25
- 8
0
votes
0 answers
C++ its captures character '\n' in the end of file if i Endl, if i dont write endl, it captures last character twice
hello I am trying to write a C++ program that reads a string from a file and checks whether it is palindrome or not using file handling to Improve my File handling concepts.
but it's not working fine the problem I am facing is
file << palindrome;
if…

Farhan Ashraf
- 11
- 3
0
votes
2 answers
How to read multiple text files from a directory, convert them all to excel files
I have 10s of tab delimeted text files in my local directory. When I copy and paste a text file into an excel sheet, it becomes a file having 100s of columns. Now, I would like to read all the text files and convert them to corresponding excel…

ychaulagain
- 73
- 1
- 8
0
votes
1 answer
How to view saved file in external storage on phone?
I have written code for writing content and viewing pdf in flutter
For writing :
writeOnPdf(){
pdf.addPage(
pw.MultiPage(
pageFormat: PdfPageFormat.a4,
margin: pw.EdgeInsets.all(32),
build:…

Technosoft Patel
- 27
- 5
0
votes
1 answer
Python Append file should refreshed with new data
I am trying to write my output into a file what my code is doing is that its looking for matched file names and storing it into a file similary for unmatched files but the problem is when i use write it overwrites the file and when i use append on…

Ankit Kumar Sharma
- 57
- 1
- 9