23 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for markdean1989

I wonder why this program does not do any changes to the text file that I am trying to modify. Scenario: My program uses the Fstream header file, I declared infile as IFSTREAM and outfile as OFSTREAM. I simply want to transfer data from infile to outfile. The data is …

Member Avatar for markdean1989
0
354
Member Avatar for Auroch

Hello everybody! I'm trying to count the number of occurrences of each word in a text file. Problem situation requires to realize menu using "switch" statement (If file exist or not). There are following errors in my program ("case b" and "default" is not working): **[C++ Error] 03_int.cpp(61): E2126 Case …

Member Avatar for Auroch
0
967
Member Avatar for Elixir42

Dear Kind DaniWebbers, I am trying to overload the fstream operators (ofstream/ifstream), so that I can save a class to a 'Binary' file and also display it with cout. But the ways in which each need to be implemented is different. Please can you show me how to define different …

Member Avatar for vijayan121
0
4K
Member Avatar for CreatorZeus

I'm having a simple i/o with file problem. I have the name coming from a string but it just wont open at all. Incoming code: string notename[] = {"NULL","empty"}; ifstream readnote; readnote.open(notename[x].c_str(),ios::in|ios::out); if(!readnote) { cout << "Read Error"; } its prolly something small but i keep getting the error, can …

Member Avatar for CreatorZeus
0
281
Member Avatar for mixelplik

Please, I know this is a simple question. I'm copying this code out of my text book, almost ver-mother#&$(ing-batm And it mother#&$(ing refueses, REFUSES to open the mother#&$(ing file and write to the mother#&$(ing array. WTF - Sorry for the language, but this is so stupid and silly and I …

Member Avatar for mixelplik
0
188
Member Avatar for nah094020

So i just started my project on a cpu sim , but right of the bat i ran into a problem #include <cstdlib> #include <fstream> #include <iostream> using namespace std; /* * */ int main(int argc, char** argv) { return 0; } void cpu() { } void memory() { int …

Member Avatar for nah094020
0
495
Member Avatar for marnun

It seems I don't understand completely reading from and into files, line by line. Here is my code that is supposed to read lines of two file, into string variables, I assume, and then write them into third file: *line of first file line of second file .... so on …

Member Avatar for marnun
0
263
Member Avatar for pattmorter

a friend asked me to help him with his lab. the lab involves opening a file and adding the numbers in the file together displaying how many even and how many odd numbers there are. I have the file "textinput.txt" in the directory with the .cpp file but when i …

Member Avatar for pattmorter
0
287
Member Avatar for ThomsonGB

//////////////////////////////////////////////////////////////////////////////////////// // In this little project I am trying to learn to get and manipulate data from // a file input using fstream strings I also wanted to use the formating available // with the printf and related string handling methods. I have a question in regards // to the …

Member Avatar for ThomsonGB
0
256
Member Avatar for Assassin7893

Guys, I've been stuck on this for a while now. This is actually one of my assignments, and I'm really lost. This is the assignment: ------------------------------------------------------------------------------------------- You manage a .txt file containing the customer ID number and account balance of the members of a bank. Last week, a computing error …

Member Avatar for Assassin7893
0
843
Member Avatar for Zssffssz

Ok so I want to have the user imput a name of a file to decode it. How would I do that? EX: cin>>fill ifstream in (fill)

Member Avatar for limaulime
0
248
Member Avatar for iamthesgt

In writing a logfile program, I need a function to output the log entries between two dates. I use [ICODE]seekg()[/ICODE] and [ICODE]tellg()[/ICODE] to save the position of the first entry to output and last entry and then go back later to output the data in between. However, [ICODE]seekg()[/ICODE] when told …

Member Avatar for iamthesgt
0
261
Member Avatar for The physicist

Hi all, I'm sure it's an error by me, but I'm having a problem with ifstream inside a loop. The reason for the loop is read in a piece of text from multiple files, and cases within the switch statement change the filename, path is previously declared. The first iteration …

Member Avatar for The physicist
0
2K
Member Avatar for TheFueley

I'm having trouble figuring out how to use exceptions to check if a file stream was created successfully. I know I can use if statements, but how do I do this using try/catch statements? It compiles successfully but it gives me an error when I supply a non-existent filename as …

Member Avatar for TheFueley
0
8K
Member Avatar for puretnaant

Hi, I'm having trouble displaying the numbers in the file on the screen. The numbers are in the .data files but i cant get them to display. [CODE]//****************************************************************************** // Exercise: Homework 07 Arrays and pointers // This program reads two sets of integers from the text files A.data and B.data. …

Member Avatar for misfit956
0
146
Member Avatar for Alexkid

Hi there, ok, im fairly new to c++ and have been trying to figure this out for ages: I have a text file i want to read in that contains lines and lines of lat long points; N50 42.22 W002 55.33 N50 42.22 W002 55.33 N50 42.22 W002 55.33 i …

Member Avatar for Ancient Dragon
0
194
Member Avatar for globberbob

Hi there, im new to the site and am hoping someone out there can help me with my question, im pretty newbie in the world of c++ and programming in general. Im making a program with a menu, you can choose between entering a number yourself to be tested as …

Member Avatar for globberbob
0
312
Member Avatar for RobBobSmith

Hello all, I have a text file called: concentrations.dat The file contains a lot of different data. Here's the data that I'm interested in: # ET: list of elements <ET> 'Cu' 'C' 'Sr' 'He' 'Mg' 'O' 'Cr' What I want to do is read the elements into a vector called …

Member Avatar for RobBobSmith
0
249
Member Avatar for rowanmck

Hi, I'm a newbie to C++ so please be patient. I have to create program that outputs a simple moire pattern or a graph of y-values from a .csv file depending on which one is called. The code below is what I have before main and is where I am …

Member Avatar for uridvir
0
2K
Member Avatar for Vani3863

Hi All, I'm a relative newbie having trouble completing a program that is required to read the text character by character from a .txt file and to then encode certain characters to something thing else. It is then supposed to be output to a separate .txt What seems to happen …

Member Avatar for Vani3863
0
158
Member Avatar for fire_

Hello. I have some problems. 1.With for cycle. This is my code: [CODE]#include <iostream> #include <fstream> int main () { int i; int i2; char sentence [200]; char repeat; ofstream file ("file.txt", ios::app); for (i=0; i<1;) { cout << "Enter sentence (max. 200 symbols)\n"; cin >> sentence; if (!file) { …

Member Avatar for Kanoisa
0
150
Member Avatar for Griff0527

I've searched the C++ forums and cannot find anything that relates to my question. I am writing a program (for class) that opens a txt file and reads doubles from the file, then computes the standard deviation of the numbers in the file. In order to do this, I am …

Member Avatar for Griff0527
0
245
Member Avatar for whouton

Hi guys, I'm trying to make a function that allows the user to enter in a file name and access that file; if the file name is wrong or the file is not there, I want to allow the user to enter in another file name. For some reason the …

0
75

The End.