90 Topics
|
|
hello everyone, I am having a major problem with this assignment that asks to create a function whose input is a reference to an input file, which asks user to enter a file name to open for input, then checks to see where the file opened successfully. the function returns … |
|
First of all, just registered and this forum looks great! PROBLEM: My program which I wrote in Code::Blocks, has compiled fine and has worked fine, but when I run the outputted file called (BINDED.exe) it shows a very quick console window then closes, I think this is due to the … |
|
I have noticed the foolowing details regarding fstream. the following combination of openstate flags do not truncate the files. ios_base::out | ios_base::in | <any flag other than ios_base::trunc> ios_base::out | ios_base::app | <any flag other than ios_base::trunc> the following combinations are resulting in a failbit ios_base::app ios_base::ate ios_base::app | aos_base::ate … |
|
Hey guys, i'm Working On A Project That Gets All Employees And Their Data From the User Then Saves Them in A Txt File ( Fstream ) Anyway, i figured out how to Do That But What im at stuck at now is how to search through the txt file … |
|
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 … |
|
How would I go about attaching a stub to my payload, which shall control the execution of the payload. I have looked into file mapping [url]http://msdn.microsoft.com/en-us/library/windows/desktop/aa366556%28v=vs.85%29.aspx[/url], but I am not 100% certain this is the right way to do that? Thank you. |
|
//////////////////////////////////////////////////////////////////////////////////////// // 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 … |
|
[CODE]#include <iostream> //standard input and output #include <fstream> //file input and output #include <string> //for strings #include <exception> //catches exceptions #include <sstream> //stringstream comes from here #include <algorithm> #include <stack> #include <queue> using namespace std; bool writeFile(const string &data); //writes strings to file bool readFile(); //read file bool palin(const string … |
|
Hey guys. Im trying to open a file the user entered. [CODE] cout<<"Please enter the file name"; cin>>name; cout<<"Do you want to open the file? [yes] or [no]"<<endl; cin>>pick; if(pick=="yes") system("C:\\wmplayer.exe [COLOR="Green"]fname[/COLOR]"); else cout<<"Good bye"; [/CODE] How do i get the value thats in fname to be printed their so … |
|
Im trying to open a file. The user enters the name of the file they want to open example [CODE] string fname; string pick; cin>>fname; cout<<"Do you want to open the file?"; cin>>pick; if(pick=="yes") system("wmplayer.exe [COLOR="Green"]fname[/COLOR]"); else cout<<"Thanks for your time; [/CODE] Can someone show me how the replace the … |
|
In this code i would like to store the values that are being outputted. [CODE] fstream filestr; char check[4]; filestr.open("D:\\bio.pdf", fstream::in | fstream::binary); if(filestr.is_open()) { int i; char check[4]={0}; for(i=0;i<4;i++) { filestr.read(&magic[i],1); [COLOR="Red"]cout<<hex<<static_cast<int>(check[i])<<endl;[/COLOR] //<-- This LINE } } [/CODE] The numbers that are printed here i would like to save … |
|
I've to make several experiments of some algorithms. I want to send those results to a .txt file [CODE] //.... for (count= 1; count<= 20; count++){ //.... std::cout<<exp<<"Time: "<<duration << " seconds" <<'\n'; ofstream f2; f2.open("results.txt", ofstream::out); for(int i=0; i<=20; i++){ f2<<duration<<endl; } f2.close(); } [/CODE] With this code, I … |
|
Hey guys. I just learn about magic numbers today. I am trying to make a program that uses fstream along with magic numbers to tell what a file is. Example the magic numbers for jpg are ff d8 ff e0. How do i check a file to see if its … |
|
i have 3 files one main.cpp, functions.cpp, and a header.h im using [CODE]#include<fstream>[/CODE] 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;" … |
|
I am trying to open a text file in C++. I dont want the file to be open in the console i want to open the file using one of the text editors like gedit. Can someone show me how to open it using gedit and not in the console. … |
|
Hey guys i am having a little trouble with this code [CODE]# include <fstream> # include <iostream> # include <string> using namespace std; int main() { fstream filestr; filestr.open("text.txt", fstream::in | fstream::out | fstream::app); filestr.close(); return 0; }[/CODE] But i keep getting a error when i run it 1> All … |
|
Ok here it is: I want to read a file backwards, the catch is that I want to do this in binary mode to make a, really lame, data encryption program. Is there any easy way (<10 lines) To do this? |
|
What I want to do is read a whole paragraph of text from a custom file. How would I do this without doing something silly like this? [CODE]while(someFile >> word1 >> word2 >> word3){ //etc. }[/CODE] I need to be able to read 3 numbers for todays date, then read … |
|
I have an assignment to create a file with number 1-20, and another one with numbers 100-5 decreasing by 5. I've got those two down, but then I need to multiply both those files together one by one and have the answer output to another file. ie: 1*100= 100, 2*95= … |
|
i have to count three districts 1, 2, 3 whom said no and whom said yes, which i had saved it in notepad the three districts. i have to use the while loop. i was trying ifstream iFile; inFile.open("vote.dat") while(district1 == yes) { cout <<"the district 1 said yes: "; … |
|
Hi! I'm a newbie in this forum. I'm a novice C++ programmer and we are tasked to create a program with the following requirements: [QUOTE]Given the sequence of numbers [I][B]n a1 a2 a3 . . . an[/B][/I] a simple histogram should be printed to the computer screen. The number [B][I]n[/I][/B] … |
|
I've found some similar posts on opening different files with the same file stream but they are difficult to understand. I'm trying to figure out for a larger project why I can't use the same file stream as in this example and what an alternative solution may be. And yes … |
|
|
I had a problem with some program I wrote that edit specific values within a specific file. When I saved the values, using fstream's write() function, everything between these values became null. I've looked again in the I/O tutorial - [URL="http://www.cplusplus.com/doc/tutorial/files/"]http://www.cplusplus.com/doc/tutorial/files/[/URL] and saw that they use memory block at the … |
|
Hi I have a problem with a code I made, some save editor for some game. The code suppose to write 2 bytes to a specific offset in some file. The file's short integers are saved as little endian. everything works fine, but when one of the integers equal 10, … |
I have written the following program. It collects inventory information and stores it in a file. I need to write a separate program that will access that file and give me the totals of the information stored in it ie. (quantity,wholesalecost,retailcost). What I'm specifically having trouble with is how to … |
|
Hi. I wasbwondering if there was a way to have the user input something to a string and then write that as the filename. Please use my example of the string deckname. |
|
[COLOR="Red"][B]//This is the main file[/B][/COLOR] [CODE]#include<iostream> #include<fstream> #include<string> #include "Books.h" #include"account.h" using namespace std; int main() { cout << "\tWelcome\t" <<endl; cout << "1-Login" <<endl; cout << "2-Register" <<endl; cout << "3-exit" <<endl; cout << "Please enter a choice: "; cin >> choice; switch (choice){ case 1: system ("cls"); cout … |
|
Hello guys! I'm having a rather pesky problem working with fstream. I could write, for example: [CODE]fstream file("text.txt");[/CODE] then file should be open in read/write mode. But then if I do the following: [CODE]file << "Some text"; file >> string_var;[/CODE] or in the opposite order, it will only perform the … |
|
Hello, im trying to make a program that reads from a file and sums up only the numbers.the numbers ar aranged like this in the file: 100er34 67 yyy 7 5 63 6 1 My problem is that the program sums up wrong,it sums some numbers twice when it see … |
|
Alright - this is my conundrum. As a noob to C++ I am only in chapter 9 of my book, having just covered object oriented programs and the exciting world of vectors and arrays. I have an assignment that asks me to run a loop to get and calculate a … |
The End.