Questions tagged [file-processing]

333 questions
-1
votes
2 answers

how to print in terminal from a txt file

So I'm currently learning file processing for my assignment, and I'm wondering why this code #include int main(){ char test[255]; FILE *open; open = fopen("data.txt", "r"); while(fscanf(open, "%s", test)!=EOF){ …
Cyanta
  • 1
  • 3
-1
votes
1 answer

How to make my program increase the price of the book (percent) depending on user inputs?

I've made a program that reads a file named "books.txt" and displays its contents. In the file, there is a price for each of the 4 books. I'm not sure how to make my program increase the price of the book (percent) depending on user inputs; for…
ibo salaj
  • 11
  • 2
-1
votes
1 answer

filestream processing in c++(tellg() function)

i wrote the following code.... #include< iostream> #include< fstream> using namespace std; int main() { ifstream in("text1.dat",ios::in); enum choice{zero=1, credit, debit, exit}; choice your; int balance; char name[50]; int…
AvinashK
  • 3,309
  • 8
  • 43
  • 94
-1
votes
2 answers

How to create multiple files after each 10,000 records in for loop after fetch?

I have about 1,000,000 records that I would like to loop through and write the contents in about 10 different files. Below is my code that successfully create a single large file : f = open("c:\temp\filename", 'w+') # write to file for rec in…
-1
votes
1 answer

i would like to extract the pspictures from a tex file and put the in another file so they can processed into ps or pdf files really easily

I have a list of files .tex file that contain fragments in the tex that build ps pictures which can be slow to process. There are multiple fragments across multiple files and the end delimiter is \end{pspicture} % this is the beginning of the…
-1
votes
1 answer

My program compiles but still shows an error, java.util.NoSuchElementException

public static void cCommand(Scanner in) throws FileNotFoundException { System.out.println(); System.out.print("Type an output file name: "); String outFile = in.nextLine(); PrintStream ps = new…
-1
votes
2 answers

Read file then stop then continue until given line

Python 3.7 question. I do have a file looking like this: 1 10 10 10 3 25 29 10 52 55 30 70 70 20 0 where 1 shows there will be 1 line coming, 3 shows 3 will come, 0 marks end of file. How to achieve this? I've tried def read_each_course(filename): …
batlin010
  • 15
  • 4
-1
votes
1 answer

Java code to list in all files from a directory with a particular word in filename

I have a directory with huge number of files,I need to list all the files from that directory with a particular word on it's name,like India or else. Also how to get the path of that files?
Shanto George
  • 994
  • 13
  • 26
-1
votes
1 answer

Converting a list of ints or floats read from a file to a numpy array

I have bunch of int values that I have to read from a file and store it in a numpy array. This is how I am doing it: el_connect = np.zeros([NEls,3],dtype=int) for i in range(0,NEls): connct = file.readline().strip().split() for j in…
user8210645
-1
votes
2 answers

why I will print "NaN" in java?

I pass a file into the method. Then, I read the method by line. After that, if the line fulfills my condition, I will read the line by token-based, and update i. My question is, from the output, It looks like my I do not successfully update because…
-1
votes
1 answer

Read single varible from txt file each time processing multiple files using pandas and python

I stored a calculated variable in another file let's say A.txt as follows: 123 1123 123 123 123 ... I want to use single variable each time from file A.txt (sequentially) when each acb.* read by pandas, processing acb.* multiples files that I was…
Abhijeet
  • 1
  • 5
-1
votes
2 answers

Inserting comma at predetermined positions in txt file

I have a file that comes as follows: 10030004 10300048 10919013 That is a txt file which contains data and each new line is a new observation. This file comes along with a document stating that for instance: Variable: A Start: 1 Length: 3 Variable:…
Daniel2805
  • 77
  • 1
  • 8
-1
votes
3 answers

Parse text file line by line and make tuples every n separator in Python

I have a text file. I want to read the file line by line, split with separator and make tuples every n separator. The example is : "A-B-C-D E-F-G Thank You! For Helping Stranger-seeker " Output of above lines will look…
tryCatch
  • 23
  • 1
  • 6
-1
votes
3 answers

Python Split File by Newline into Chunks

I have a file which is separated by newline into chunks of the same number of rows. Each row is a field. For example, in chunk1, the first field = a1,a2,a3. In chunk2, the same field =…
Jia
  • 1,301
  • 1
  • 12
  • 18
-1
votes
1 answer

Perl Machine Learning

To find Start, Processing and completion time of input data file Problem Description: From the input file, we need to process line by line, from that lines, we have to add 7th column values until lessthen or equal to 30, it can be n number of…
kprasath
  • 11
  • 1