2,025 Topics

Member Avatar for
Member Avatar for ShawnCplus

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 …

Member Avatar for ShawnCplus
0
1K
Member Avatar for jbennet

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 …

Member Avatar for Salem
0
155
Member Avatar for Mylena

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 …

Member Avatar for Mylena
0
213
Member Avatar for Akilah712

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 …

Member Avatar for iamthwee
0
287
Member Avatar for tomotao

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 …

Member Avatar for tomotao
0
355
Member Avatar for Woody714

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 …

Member Avatar for John A
0
926
Member Avatar for Matt Tacular

**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? …

Member Avatar for Salem
0
149
Member Avatar for Slavrix

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 …

Member Avatar for Slavrix
0
93
Member Avatar for louis7370

[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() { …

Member Avatar for iamthwee
0
108
Member Avatar for mathgirl

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 …

Member Avatar for ndeniche
0
116
Member Avatar for ghadahelal

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 …

Member Avatar for ghadahelal
0
110
Member Avatar for louis7370

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()) { …

Member Avatar for Salem
0
138
Member Avatar for snedan

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()) …

Member Avatar for Narue
0
90
Member Avatar for yesm

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 …

Member Avatar for Narue
0
143
Member Avatar for kmachstang

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 …

Member Avatar for vijayan121
0
249
Member Avatar for RaCheer

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 …

Member Avatar for RaCheer
0
142
Member Avatar for louis7370

[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 …

Member Avatar for Ancient Dragon
0
325
Member Avatar for youngone

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> …

Member Avatar for John A
0
135
Member Avatar for adnichols

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 …

Member Avatar for adnichols
0
134
Member Avatar for pooja_singh

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 …

Member Avatar for WaltP
1
316
Member Avatar for sakura_fujin

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 …

Member Avatar for vijayan121
0
173
Member Avatar for n.aggel

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 …

Member Avatar for WaltP
0
90
Member Avatar for gamodg

[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 …

Member Avatar for Salem
0
83
Member Avatar for gamodg

[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 …

Member Avatar for GreenDay2001
0
76
Member Avatar for Derice

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 …

Member Avatar for ~s.o.s~
0
132
Member Avatar for Bahama.Mama

:-| 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 …

Member Avatar for Ancient Dragon
0
145
Member Avatar for sakura_fujin

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. …

Member Avatar for Lerner
0
221
Member Avatar for mapaputsi

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 …

Member Avatar for Phaelax
0
84
Member Avatar for Brent.tc

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" …

Member Avatar for Brent.tc
0
160
Member Avatar for jobra

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 …

Member Avatar for Salem
0
106
Member Avatar for RaCheer

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 …

Member Avatar for ~s.o.s~
0
156
Member Avatar for bluecat

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 …

Member Avatar for bluecat
0
98
Member Avatar for fesago90

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 …

Member Avatar for Ravalon
0
5K
Member Avatar for elodie

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 …

Member Avatar for Lerner
0
1K
Member Avatar for fesago90

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 …

Member Avatar for jwenting
0
140
Member Avatar for BILL S

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 …

Member Avatar for Chaky
0
123
Member Avatar for vicky_dev

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 …

Member Avatar for Ancient Dragon
0
115
Member Avatar for GreenDay2001

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 …

Member Avatar for Ancient Dragon
0
210
Member Avatar for itchap

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 …

Member Avatar for itchap
0
199
Member Avatar for raptoro104

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?

Member Avatar for raptoro104
0
119
Member Avatar for Lost in Code...

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 …

Member Avatar for Ancient Dragon
0
272
Member Avatar for adkozak

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> …

Member Avatar for adkozak
0
151
Member Avatar for bucsoldier03

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. …

Member Avatar for pigeonfoot
0
1K
Member Avatar for xerA

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 …

Member Avatar for Ancient Dragon
0
113
Member Avatar for batista06

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 = …

Member Avatar for Ancient Dragon
0
126
Member Avatar for term

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 …

Member Avatar for ~s.o.s~
0
89
Member Avatar for silicon

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 …

Member Avatar for ~s.o.s~
0
273
Member Avatar for king13

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 …

Member Avatar for king13
0
112
Member Avatar for king13

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 …

Member Avatar for king13
0
993
Member Avatar for DmD

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] …

Member Avatar for Nick Evan
0
1K

The End.