file-handling

Problem while reading objects from file in c++

空扰寡人 提交于 2020-12-15 03:52:16
问题 I am doing a small college project where I have to add, edit and search records in/from file using OOP concept. Adding into file is working fine but whenever I try to read from file it is printing in unreadable texts. Here is full code and output. main.cpp #include <iostream> #include <cstdlib> #include <fstream> #define MIN 20 #define MAX 100 #include "student.h" using namespace std; void add_student(); void edit_student(); void search_student(); void addToFile(const Student&); Student*

Python Memory Error when reading large files , need ideas to apply mutiprocessing in below case?

守給你的承諾、 提交于 2020-07-16 04:22:46
问题 I have the file which stores the data in the below format TIME[04.26_12:30:30:853664]ID[ROLL:201987623]MARKS[PHY:100|MATH:200|CHEM:400] TIME[03.27_12:29:30.553669]ID[ROLL:201987623]MARKS[PHY:100|MATH:1200|CHEM:900] TIME[03.26_12:28:30.753664]ID[ROLL:2341987623]MARKS[PHY:100|MATH:200|CHEM:400] TIME[03.26_12:29:30.853664]ID[ROLL:201978623]MARKS[PHY:0|MATH:0|CHEM:40] TIME[04.27_12:29:30.553664]ID[ROLL:2034287623]MARKS[PHY:100|MATH:200|CHEM:400] Below method I found to fulfill the need given in

Why is this code skipping the first character and printing a special character at the end of the file

这一生的挚爱 提交于 2020-07-10 10:29:29
问题 ch = getc(lname); while (ch != EOF) { ch = getc(lname); if (ch == '\n') temp++; //except the line to be deleted if (temp != delete_line) { //copy all lines in file replica.c putc(ch, rep); } } I have a file in which I have the following data Aryan Verma Vinayak Sharma Dev Deol Ameesh Deol the above code basically skips the line of data that I want to by putting the line value in delete_line. Here, temp is initiated to be 1. Now the problem is, this code is skipping the first char, i.e. "A" in

File.createTempFile in Java getting Incompatible type error

◇◆丶佛笑我妖孽 提交于 2020-06-29 03:52:16
问题 Till now my code works fine where I am creating file in temporary directory and processing it. But now I am trying to provide specific directory where I actually want to create xml file. So in method createTmpXmlFile private static Path createTmpXmlFile(final String prefix) { try { log.info("Creating temporary file {}{}", prefix, XML_SUFFIX); return Files.createTempFile(Paths.get(gleifZipFile), prefix, XML_SUFFIX); } catch (IOException e) { throw new IllegalStateException("Could not create

File.createTempFile in Java getting Incompatible type error

南楼画角 提交于 2020-06-29 03:51:08
问题 Till now my code works fine where I am creating file in temporary directory and processing it. But now I am trying to provide specific directory where I actually want to create xml file. So in method createTmpXmlFile private static Path createTmpXmlFile(final String prefix) { try { log.info("Creating temporary file {}{}", prefix, XML_SUFFIX); return Files.createTempFile(Paths.get(gleifZipFile), prefix, XML_SUFFIX); } catch (IOException e) { throw new IllegalStateException("Could not create

How can read Minecraft .mca files so that in python I can extract individual blocks?

倖福魔咒の 提交于 2020-02-05 05:27:09
问题 I can't find a way of reading the Minecraft world files in a way that i could use in python I've looked around the internet but can find no tutorials and only a few libraries that claim that they can do this but never actually work from nbt import * nbtfile = nbt.NBTFile("r.0.0.mca",'rb') I expected this to work but instead I got errors about the file not being compressed or something of the sort OSError: Not a gzipped file (b'\x00\x00') Full errors: raceback (most recent call last): File "C: