2,025 Topics
![]() | |
I'm having a slight problem. This particular function is crashing caused by the Loadfile ifstream being opened. [code=c++] void LoadChar(Entity players[], char saveNum) { string filename, saves; saves = saveNum; filename = "save/Save" + saves + ".sav"; char *file; file = const_cast<char*>(filename.c_str()); ifstream Loadfile(file, ios::in); //this little diddy right here … | |
Okay I have made a c++ console application to take user input and append it to a text file and then read it back. I am using the win32 version of Dev c++ [code] #include <iostream> #include <fstream> #include <string> using namespace std; int main(){ int choice; cout << "What … | |
Hello! I need to invert a 24-bit bmp image from right to left, and from top to bottom. I know how to invert colours, but not the position. I only know fstream to open and close files. This is what I did (below). Please let me know where I am … | |
Hi, I am working on a program that reads through a file, gets the words, and finds all the anagrams in the file. For example if the input is Pans stop pots pots Sits it's snap I have no trouble reading the words from the file. I create a signature … ![]() | |
everything seems to go fine except when i get to the search. either the program runs with a runtime error ,and it cannot be excuted. [code] /***************************************************** Program Filename : post.cpp Date : May 27, 2007 Purpose : NC code convert Input from : a cls data file Output to … | |
I'm fairly new to C++ and have an assignment that is knocking me out. The text file is fairly simple: Plain Egg 1.45 Bacon and Egg 2.45 Muffin 0.99..... etc.... And the code is: [code=c] //Breakfast Billing System //Marlen LaBianco //May 20, 2007 //Program to calculate a local restaurant's breakfast … | |
**I know the code looks big, but it's a very small isolated section at the bottom (starting at line 164) that's giving me the problem.** When this program is run, when I try to open the file I just appended some text to, it doesn't open... can anyone spot why? … | |
my code was working, but when i added in a new section to enter playing against a computer player, it now hates me, and wont stop trying to kill me. [code=c++] //name: ******* //Lab: * //purpose: ******* //modification date:*********** #include <iostream> #include <cstdlib> #include <ctime> using namespace std; const int … | |
[code=cplusplus] #include<iostream.h> #include<fstream.h> #include<cstdio> #include<typeinfo> #include<cstring> #include<sstream> #include<algorithm> #include<ctime> char* itoa(int n, char *buf,int) // { // ostring out; // out<<n; // strcpy(buf,out.str(),c_str(); // return buf; // } class string class const struct Node class VCDdetails { private: char vcdid[6]; char movietitle[50]; char castofmovie[50]; int numvcdcopy; public: void addVCDdetails() { … ![]() | |
I am trying to write a program that will prompt the user for six grades to be entered (one at a time), read in each grade entered by the user, and store them in an array of six elements. Grades should be on a 0 to 4.0 (inclusive) scale, and … | |
hi all, i have a caputure file ( *.cap) i open it in binary mode , now i nead 2 make an outfile , also *.cap i gave the outfile 2 my prog. out.cap, it works and i became no errors, but when i tried 2 open it , it … | |
why my program don't execute? [code=c] void Supplier::AddDetails() { char ch='y'; int end; fstream suppauto; suppauto.open("Supplier.txt",ios::app); suppauto.seekg(0,ios::end); while (ch=='y') { char s[12]; system("cls"); cout<< " Adding Supplier Details"<<endl; cout<<" ****************************************"<<endl<<endl; suppauto.seekg(0,ios::end); end=suppauto.tellg(); if (end==0) { suppauto.close(); strcpy(suppcode,"S0001"); } else { suppauto.close(); for(int i=0;i<6;i++) suppcode[i] = '\0'; fstream suppauto1("Supplier.txt",ios::in); while(!suppauto1.eof()) { … | |
ok, i need small help, to create/open a file with specific name, in order to make it clear here's a small function from my program [code=cpp] void CreateNew () { string fileName = "helpme.txt"; //==>>> my problem!! ofstream DataFile; DataFile.open(fileName, ios::out | ios::app); // string fileName == filename if (DataFile.is_open()) … | |
I've got a custom class that is as follows: [code=C++]class course { private: string prefix; int number; string title; int credits; char grade; public: //Constructors course(); course(string, int, string, int, char); //Accessors void set(); void print() const; string get_prefix() const; int get_number() const; string get_title() const; int get_credits() const; char … | |
Hi guys, I need some help with file input output. I have a file that has a array size on the first line followed by a 2d array. The array size can change. I need to read this file, and place the array in a array variable. But im not … | |
I am trying to write a program that will scan another file for comments only. It will scan for comments of both types, // and /* */, and then print these comments. The code I have written so far works, but it prints the entire code. I would really appreciate … | |
[code=c] #include<iostream.h> #include<fstream.h> #include<conio.h> ofstream Ofil("ROW-COLUMNAR.DAT",ios::app); class application { private: int number; char application [20]; public: void accept_data { cout<<"enter application: "; cin>>"application: "; Ofil<<"application"<<endl; } void display_data() { char appl; ifstream Ifill("ROW-COLUMNAR.DAT",ios::app); while(Ifill) { Ifill.getline(appl); cout<<appl; } } }; class Calculator:application int mc(int x, int y) //Multiply two numbers … | |
This assignment I must read this .DAT file the instructor has given to me, and print out the information from it. The .DAT file is for a two-way array It has 6 rows and 8 colloumns well I have ran into a couple of problems [code] #include <iostream.h> #include <fstream.h> … | |
I have been having difficulty trying to figure out how to read in data backwards. I get the idea, but have no idea how to properly code it since it is string data from a txt file. I was given the basic file to start with, but need to add … | |
hi!!! this is pooja and i need some help desperately.... i have been told to submit my project in 15 days on airline reservation ..using graphics,filemanipulation,friend function,inheritance and all such features.... prob ic dat file manipulation is yet not taught and inheritance is still too new ..never d less i … | |
![]() | hello! I badly need to submit this program within an hour from now so any help out there who could help debug my code, i would really appreciate it. there's something wrong with my qsort() syntax but i can't figure out what . spent 5 hours trying every possible ways … |
hi, i have this simple code, that compiles on visual studio 2005.When i try to run the executable through visual studio {pressign ctrl+F5} it does nothing{although the test.txt has size of 1kb}, when i run the exe through the command prompt the program works fine... Does anyone know why this … | |
[code=cplusplus] #include<stdio.h> #include<conio.h> #include<fstream.h> void file() { for(int i=0;i<30;i++) { char a[10]="2-2aa.pak"; a[4]=a[4]+i%26; a[3]=a[3]+((i/26)%26); fstream file; file.open(a,ios::in |ios::out); file<<"anshulgarg"; file.close(); } } void main() { file(); } [/code] it creates 30 files with new names in bin but when i give relative path ex "\\p\\2-2aa.pak" and adjust a[8],a[9] appropriately it … | |
[color=#3333FF]presenting here a program fragement of my project two files mainn.txt mp.txt format i have given at the end of this code the problem is that while printing mp.txt the output is not in format as i expected [/color] [code] [color=#33CC00]DF: 1 SA: 2-2 DA: R1 D: 3 SA: R1 … ![]() | |
i am a newbie in C++ file processing... Any1 can guide me to search for an item(lastname) in the example below? what is [B]seekg[/B] or [B]seekp... [/B]how to use it? [code=cplusplus] #include<iostream> #include<fstream> using namespace std; void main(){ char firstname[10], lastname[10]; int age; ofstream write("text.txt", ios::app);/*actually i am not sure … | |
:-| I am desperate... Can someone help me to debug this program.. It is a dynamic allocation file ..... > Write a program that will open a sorted text file, compute how many lines are in the text file, and then create an index that will tell at which byte … | |
![]() | need help! what's wrong with my code? it compiles but outputs nothing. it requires the user to create a "word.txt" text file for it to start counting the frequency of occurrence of words. i'm a newbie here in daniweb and a novice in C++ programming. i really appreciate any help. … |
Guys please i need help about creating a sequential file using java, im kinda new in this world of java...please!! something like this: int main() { ofstream outclientfile("client.dat", ios::out); if(!outClientFile) { cerr<<"statement"<<endl; exit(1); } cout<<"Enter the account, name and balance."<<endl <<"Enter end-of-file" to end input."; int account; char name[25]; double … | |
I've been working on a program (nothing big, or anything) and there are some things I'd like to work (That has nothing to do with the fact that there supposed to work :) Problems: 1 - Screen won't clear (This seems to be the most frequent question about c/c++ "ms-dos" … | |
Hi all, I want to write every given number of lines into the different files, which I will be passing as an command line argument. I have written a function for just dividing the file into two, but how would I divide the files for every given number. If anyone … | |
I have written a program that allows the user to insert scores and the program then provides the average score, the number of scores entered, the amount of each letter grade, and the highest and lowest score. I've also used a sentinal to exit. I'm new to C++ and this … | |
To do shapes in the form I use a vector that stores a struct with the x, y, color and shape values of every shape I put on the form. I have to save and open these values. To save and open files with shapes. I use a TOpenDialog and … | |
Aright, now all of you might be tired of my sometimes info-lacking posts about binary files. ... but I have another quick question: How do I write and read a double in a binary file? Code as simple as the following does not work (which is the usual code for … | |
Hi, I'm having difficulty in converting an ansiString to a string, i've searched loads on this but could only find how to convert a string to an ansistring. I'm tring to open a filestream for reading using the filename selected by the value of an open file dialog. Code below … | |
I'm doing a homework for my programming class, the following code is a part of my code which I cut out and formatted to be a 'runnable' program. Now, if you run it you'll notice it creates a data.txt file, writing the amount of student IDs in the record as … | |
I had my Toshiba running a good drive formatted with Windows98 SE on a 40MB ram installed, it normally has 8MB internal. I set it up on a CD version of the 410 with it's SVGA graphics at 16bits, then swapped to the 8MB display CS series so I could … | |
I want to read a file which contains a list of integers. The first 4 bytes( or whatever sizeof(int) is ) indicates how many numbers the file has. Suppose I check the file size before reading so that I know I won't encounter EOF. Do I still need to check … | |
![]() | I am trying to make this program as my school project. This program basically gets data from user store it in an object [I]per [/I]and then saves it into a file PEARSON.TXT. Now the problem is that i am not able to write the data into files I dont know … |
Hi everyone, Im trying to solve this question: write a C++ program to find a given word in a file. It should display all the line numbers where the word occurs. this is the code that i did so far, the problem is it wont display all the right line … | |
I'm reading Larry Ullman's C++ Programming:Visual Quickstart Guide. He says to use the command std::cout.setf(std::ios::fixed)) (with others) to set the number of digits after a decimal. But all of his code uses std::cout::setf(std::ios_base::fixed). What is the difference? | |
I've lost my will and need some guidence, yes this is homework, i'm not going to lie about that. I know I could probably figure out how to get the answer she's wanting, but not with what she's provided as a code template below. I'm guessing that I need to … | |
Hi everyone I am trying to get done the stocks program the first function is readStocks, it compiles but deosnt give me rigth ptompt, i guess i have some kind of execution error. Could any one give me advice on that? THank you. [code=cplusplus] //Stock's statistic #include <iostream> #include <stdlib.h> … | |
i had to make a program that avereage the scores of test grades and displayed the highest grade made and also the lowest grade made and the test average. it also showed the number of vaild scores to. after making the program i have to convert it to C language. … | |
Hi everyone. I'm extremely new to this. It's my first programming course, period. I realize I probably needed a load of pre-reqs, but for some reason, I was advised to take Intro to C++ so... So far, I've been doing well! However, this latest project has me stumped... The jist … | |
Greetings...I'm trying to add a part for 2 times the rate for any hours over the first 60...Can anyone aid me? Many thanks [code] // This program calculates gross pay. #include <iostream> #include <iomanip> // Global constants const double PAY_RATE = 10; // Hourly pay rate const double BASE_HOURS = … | |
Ok this program takes rainfall data for every month of the year and displays the total and avg for each month. I need it to display each month in order of rainfall from highest to lowest as well. Im having a hard time implementing showorder into my code. Can someone … | |
Hello everyone, I just wanted to thank you in advance for all of your help. My code is now working properly except for one thing. The insertion part feels like it takes about 5 minutes to complete. I know that this method is the slowest of the 4 I was … | |
My program seems to be ignoring my cents after the decimal point for total_charge. It adds the dollar amounts, but ignores or does not see the cents. Can anyone give me suggestions as to what I need to look at? I'm brand new at coding, thus the reason for all … | |
Hello, I'm having issues with my final total for charges. When I run my program, it either comes up with "0" or if I don't declare my variable, it comes up with a long string of numbers. My total hours works great, but not my charges. Can someone take a … | |
So I'm working on a program where you fill in some textboxes and press a button to generate a .txt file with the texts in it... I'm working in Visual Studio Express (C++) The only thing i have so far is: [code] [COLOR=#0000ff]private[/COLOR][COLOR=#000000]: System::Void btnAdd_Click(System::Object^ sender, [/COLOR][COLOR=#000000]System::EventArgs^ e)[/COLOR] [COLOR=#000000]{[/COLOR] [COLOR=#0000ff]char[/COLOR][COLOR=#000000] … |
The End.