Member Avatar
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 …
by markdean1989 in Software Development ()
Member Avatar
hello again, so i want to make a programme where the file saved is saved with different names at every loop.. like at first loop it will save as file1.txt, 2nd loop file2.txt, so on... so this is my code... so this is what the code is, it will loop …
by Vikram Sehgal in Software Development ()
Member Avatar
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 …
by Elixir42 in Software Development ()
Member Avatar
please correct my code"ofstream outfile("ali.txt")"
by zahid_3 in Software Development ()
Member Avatar
I'm writing a program that will keep track of every Anime/Manga I watch/read(I'm an avid fan). I'm trying to make a database in order to keep track of all of the titles of the Anime/Manga. My problem is that when i try to add a new title to the existing …
by Sci3nc3F1cti0n in Software Development ()
Member Avatar
I am trying to write a program that creates a new file every time I use the application. Right now, this is what I am doing: What I want to actually do, is check if application001.txt exists, and if it doesn't, create that file then write to it, and then …
by sarah.mathieson.7 in Software Development ()
Member Avatar
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 …
by marnun in Software Development ()
Member Avatar
Can some one briefly tell me about that how to do fileprocessing in c++
by ousaf -3 in Software Development ()
Member Avatar
Here I have the classes Logger and Driver. Driver takes the singleton class of Logger, and logs the same statement 10000 times. I want to use this logger, so that it runs in the background and only logs every so often. This will force the program to not use too …
by sidvb1 in Software Development ()
Member Avatar
I am a brand new programmer, just learning from the web, i wrote this function as part of an accounting program to write stored values to an output file, the program compiles, and runs without any problems, but when i activate this function from within the program nothing happens, when …
by jakezcop in Software Development ()
Member Avatar
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 …
by pattmorter in Software Development ()
Member Avatar
Hi there I've got a problem with functions, where it seems that function call return zero instead of the actual variable value, I will appreciate any help from you guys. I will post the major code parts because the program is big. I get the totallength variable value right but …
by Ahmed2 in Software Development ()
Member Avatar
Hi there I'm trying to ofstream (output) data to an excel file (csv), and I keep getting this error "file was not declared in this scope". Can you guys help me on this? where is the error? This is the output function, void FileOutput() { int t; static float totallength=0; …
by Ahmed2 in Software Development ()
Member Avatar
//////////////////////////////////////////////////////////////////////////////////////// // 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 …
by ThomsonGB in Software Development ()
Member Avatar
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 caused …
by Assassin7893 in Software Development ()
Member Avatar
Hello guys! I have to create a program that prints the last 10 lines of a text or all of it if the number of the lines is <=10. The input will be a file that is unknown to me. This is what I've done so far. include <iostream> include …
by lmytilin in Software Development ()
Member Avatar
i have 3 files one main.cpp, functions.cpp, and a header.h im using include<fstream> in the main.cpp and in the functions.cpp but im not sure where to define the ofstream datatype in, so that the main.cpp and the function.cpp share the same ofstream variable. where do i put this "ofstream outf;" …
by imgregduh in Software Development ()
Member Avatar
Hey, Does anyone know how to cpy from one file and redirect to another. I know I have to use the ofstream but I'm stuck. while (!in1.eof()) // while not end of input file { in1.getline(current, 100); // read a character from input file out1.in } I'm stuck. I want …
by ana_1234 in Software Development ()
Member Avatar
double speedTest() { double dInitialTime = clock(), dFinalTime = 0; double dRepititions = 99999999; double dResult; cout << "\nCalculating...\n\n"; for(int nCounter = 0; nCounter <= dRepititions; nCounter++) { pow(dRepititions, pow(dRepititions, dRepititions)); } dFinalTime = clock(); dResult = dFinalTime - dInitialTime; ofstream outf("Results.dat", ios::app); outf << dResult << endl; return dResult; …
by Rickay -5 in Software Development ()
Member Avatar
I'm trying to save everything to a .txt file with a new line after every string, but I can't get it to work for me. I tried using <<endl; and "\n" but it all gets written in a single line. So if I enter "John" for first , "Smith" for …
by fglom in Software Development ()
Member Avatar
Hello guys! I'm having a rather pesky problem working with fstream. I could write, for example: fstream file("text.txt"); then file should be open in read/write mode. But then if I do the following: file << "Some text"; file >> string_var; or in the opposite order, it will only perform the …
by flowerzink in Software Development ()
Member Avatar
Hi I am trying to store an array into a file. I have tried a few ways but I end up with an extra line at the end of the file. The only way I can do this without the line is by writing ofstream myfile("Stock.txt"); if (myfile.is_open()) { This …
by llamaboy in Software Development ()
Member Avatar
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. //****************************************************************************** // Exercise: Homework 07 Arrays and pointers // This program reads two sets of integers from the text files A.data and B.data. …
by puretnaant in Software Development ()
Member Avatar
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 …
by globberbob in Software Development ()
Member Avatar
Hello. I have some problems. 1.With for cycle. This is my 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) { …
by fire_ in Software Development ()
Member Avatar
why doesn't this work? int main() { fstream file; char output[100], pasword[100]; int a; const string x("Yes"); const string y("No"); string z; char b; cout << "\nEnter correct password to continue: \n" << endl; cin.getline(output, 15); if(output == "file.txt") { cout << "Change password? Type Yes or No. \n" << …
by Rickay -5 in Software Development ()
Member Avatar
Hello! I'm new to c++ but I have a problem and desparate for help. I'm trying to store string and integers into a file, but only strings get stored and integers dont. I tried casting,didnt work. Not to convolute you with my code, I came up with this small program …
by atman in Software Development ()
Member Avatar
Howdy, those of you who remember me may be happy to know my 2D game engine was finished and I'm now working on a 3D engine. My engine has been going rather spiffingly well, after some battles with DirectX and OpenGL i managed to get them working side-by-side. Wrote a …
by DarthPJB 23 in Software Development ()