2,025 Topics

Member Avatar for
Member Avatar for bolx

Hi there, i have an assignment, and i need to create a monthly expenditure. I have managed to get alot done, a fully functioning menu and all the functions. Im stuck when it comes to deleting an entry I have been using structured arrays to store data, ive posted all …

Member Avatar for bolx
0
141
Member Avatar for tomkeeee

[code=c] // lokalasss.cpp : Defines the entry point for the application. // #include "stdafx.h" /*int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. return 0; } */ //////////////////////// [/code] // ddd.cpp : Defines the entry point for the console application. // [code=c] #include …

Member Avatar for tomkeeee
0
166
Member Avatar for pczafer

hi eveyone i need to edit person name or Appointmendescription but not date or time in my program. i can write all the records to the file and can read from the file. and need to edit the file now. can anyone help???? thanks.. [CODE] void writeAppointmenRecords( ) { int …

Member Avatar for Sky Diploma
0
100
Member Avatar for blerina12

Hello guys. I have developed a program which is supposed to read several times from the same file. I have used clear() and seekg() but nothing works. When the file gets open for the second time the program doesn't read anything from it. I would appreciate any suggestions. Here is …

Member Avatar for blerina12
0
213
Member Avatar for Raerie

hi this part of my code is suppose to read from a file and update the info in the quantity of the user's choice and write back all the info in the same order to the file but with the update quantity. I am able to update to information but …

0
42
Member Avatar for guest7

Hi, I am getting "Segmentation fault" error in line number in the following function. [ICODE]deque <string> text; deque <string> text_1; int circuit::writetofile(int maxno,char *fname) { /* Before writing the clauses correct the line p cnf */ //deque<string> text; std::string s,t; /* Counting the number of original clauses in the file …

Member Avatar for nucleon
0
240
Member Avatar for Clockowl

Hey guys, How do you handle exceptions in your programs? For instance, I have this function: [code=cpp]bool load_file(const char *filepath, std::string &dest) throw (std::bad_alloc, std::runtime_error) { using namespace std; ifstream file; file.open(filepath, ios::binary); if (!file.good()) { throw runtime_error("Couldn't open the file"); } //get filesize in bytes from ifstream //seek end, …

Member Avatar for Clockowl
0
108
Member Avatar for wuzj1988

this is my program [code=cplusplus] // // custorderscf2.cpp // #include <cstdlib> // student ...... Jones, Patricia #include <iostream> // section ...... MW row .... 4 #include <fstream> // due date ..... xx/xx/xx #include <iomanip> // refer to ..... Gaddis Ch3 void SetPrecision(int); // procedure prototype using namespace std; // avoid …

Member Avatar for wuzj1988
0
161
Member Avatar for karen_CSE

Hi, I'm doing this programming exercise for my C++ class. I'm using Microsoft Visual C++. for some reason, the program wouldn't save my data. Can someone please take a look at my code and tell me what I did wrong? [code] /* Chapter 12 HOMEWORK Dung Tran CS 116 C++ …

Member Avatar for Narue
0
425
Member Avatar for guest7

Hi, I am getting the error "Segmentation fault" when i run my program. Then when i debug the code to find the cause of the error i get the following error messages. I do not know what these error messages mean: Error Message: ------------------------------------------------------------------ Program received signal SIGSEGV, Segmentation fault. …

Member Avatar for rm_daniweb
0
98
Member Avatar for Icebone1000

I dont know how to explain very well, I have a class that works 100% fine.. The problem is that now I want access that class inside of other class, when I do it, things stop of working fine and gets very unstable( some few times works, but mostly times …

Member Avatar for Icebone1000
0
277
Member Avatar for Clockowl

Hey guys, How do I disable/get rid of that default exception message windows shows when you have an "unhandled" exception in your program? Here's my example code (sorry for not limiting the code's size to the problem only, it's readable enough I think): [code=cpp] #include <iostream> #include <fstream> #include <string> …

Member Avatar for Clockowl
0
163
Member Avatar for Clockowl

Hey guys, I've this code: [code=cpp] #include <iostream> #include <fstream> #include <sstream> #include <string> using namespace std; bool load_file(const string &filepath, string &dest){ ifstream file; file.open(filepath.c_str(), ios::binary); if(!file.good()){ cerr << "Fatal error while opening file." << endl; return false; } //get filesize in bytes from ifstream //seek end, get pointer, …

Member Avatar for Clockowl
0
997
Member Avatar for Usura

Hey i have a weird problem when im trying to print out elements in my temp pointer array, at the bottom where im just using cout to print random indexs of temp, it will only work if i comment out temp[1]... anyone have any idea why? if its not commented …

Member Avatar for Clockowl
0
115
Member Avatar for yashyash

Dear friends I have a conversion from ascii to binary while when i use my input which is like this : 16078 16283 0.3708 16078 16837 0.4514 16078 17820 0.4038 16078 17906 0.3695 16283 16837 0.3905 16283 17820 0.4343 16283 17906 0.3262 16837 17820 0.5291 16837 17906 0.6245 17820 17906 …

Member Avatar for yashyash
0
88
Member Avatar for orwell84

Okay, so I'm thinking of getting a simple wired router by Linksys or something just to practice some cisco networking things that I plan on learning a bit over the summer. You know, just some IOS practice and things like that. My questions is, which router should I get? I've …

Member Avatar for hughv
0
86
Member Avatar for CPPRULZ

Hello I am currently making a program for a database which includes an SSN. The user can input the ssn but I want it in xxx-xx-xxxx and to make sure the user ddoes this have the user input 3 numbers then 2 numbers then 4 numbers in seperate cin statements: …

Member Avatar for ArkM
0
116
Member Avatar for bryansworld

I am trying to load in a list of words into my program using a dynamic array and the string class....for some reason, all the tutorials are using char which i have no idea how to adapt to my code.... [code] string *strWord; int Position = 0; string strHolding; //for …

Member Avatar for tux4life
0
148
Member Avatar for seao111

Hi, i am trying to make a general compression algorithm in c++ but i haven't really gotten the i/o part of this right yet. What i want to do somewhere along the line is to have my program parse say 10 or so characters at a time from a binary …

Member Avatar for seao111
0
163
Member Avatar for Lbs Btw.

I have my program...which displays a main menu and gives you four choices, one of which is exit. It is then supposed to move on to the next menu or the part of the program you have chosen, i.e. add temp, delete temp, list temps(this has a serperate menu of …

Member Avatar for vmanes
0
108
Member Avatar for pscha3

Hello, I just started C++ and I have this assignment to write. I started writing it but I can't seem to get this one thing and that is [U]how to create a new contact and store it in a file. [/U] I need to know if I used the structure …

Member Avatar for adam1122
0
391
Member Avatar for waldchr

I am working on a fairly large project for my chemistry teacher (NOT homework!). I thought that it would be nice if the program could search a file for a user entered string and display all lines that had that string. I have gotten it as far as I can …

Member Avatar for waldchr
0
79
Member Avatar for OffbeatPatriot

I'm trying to make a program to view 3d volumes. Basically you start with a bunch of data from an ultra sound or mri and then you load it into a 3d texture. Then you have a cursor made of three components between 0 and 1, and when you draw …

0
64
Member Avatar for cruisx

Hi guys, have a school project that i am working on but i am just running into this one problem. Well its not really a problem its more of a me just starting the c++ course and i just wanted to do something extra to get some more marks. We …

Member Avatar for computercobra
0
832
Member Avatar for DCvonB

Hi, I would appreciate any help with the problem I am having. I am trying to read text from a file (currently just 'yes' or 'no') and print the out the results in this format: 1 yes 2 no 3 no etc. I have been able to write a some …

Member Avatar for Ancient Dragon
0
174
Member Avatar for Icebone1000

The file gets more kB then the original ( 114KB to 914KB) And something weird: when I try open the new file with the notepad, it loads forever and i get a program not responding message when I try to close it, with the original file it loads ok.. By …

Member Avatar for nucleon
0
209
Member Avatar for phoenix2391

hi, I was hoping someone could help me. I've been trying to do this for the past hour with no luck. basically i'm trying to make a Celcius to Fahrenheit converter. So far, the converter works fine, except for the fact that I cant get it to display 2 decimal …

Member Avatar for Ancient Dragon
0
128
Member Avatar for apch01

cant display the correct value of the structured values with function ... is it got to do wif some buffer stuff ??? [code] #include "stdafx.h" #include <iostream> #include <iomanip> using namespace std; const int MAXCHARS = 15; const int NUMEMPS = 1; int i; struct EmpRec { long num; char …

Member Avatar for apch01
0
70
Member Avatar for nosnibor

[CODE=cplusplus] bool BODYTYPE::Seek(BODYTYPE * body) { string line; string key(body->style); size_t found = ' '; fstream file("..\\Data\\BODYTYPE.txt",ios::in); if (!file.is_open()) { cout << "Unable to open file \n"; return false; } file.clear(); file.seekg(0); for(;getline(file,line);) { if((found = line.find(key,0)) == 0 ) { file >> body->style >> body->doorCount; return true; } } …

Member Avatar for nosnibor
0
87
Member Avatar for jayli27

[code=cplusplus] #include<fstream.h> #include<stdio.h> #include<conio.h> #include<string.h> #include<iostream.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> void deposit(void); void addrecord(); void delrecord(); void modrecord(); void disprecord(); void dispall(); void withdraw(); float w,z; class account { int accountno,cls; char name[30],type; float deposit,withdraw; public: account() { deposit=withdraw=0; } int giveaccountno() { return accountno; } void getdata(int …

Member Avatar for siddhant3s
0
366
Member Avatar for XpL0d3r

I have an assignment where I need to create an inventory program where I can add information about a product to a text file, and shown in the file like shown: 1;Hammer;20;13.50 Where 1 is the record number, Hammer is the description, 20 is the quantity, and 13.50 is the …

Member Avatar for DemonGal711
0
124
Member Avatar for binamy1

I have been developing my own compression algorithm for my school project.It is like LZ77 but uses fixed blocks,and a dictionary containing the position of the repeating block (dic.inpos)& where it is to be copied(dic.charpos);I am using Gnu C++,The program crashes or gets stuck on initializing in.. Also the program …

Member Avatar for binamy1
0
140
Member Avatar for replic

Hi everyone, i wrote this small app and it works fine but it erases everything up to the offset and everything after it. Anyone knows how to avoid that? [CODE=C++]#include <iostream> #include <fstream> int main() { int hex = 0x75; std::ofstream f("sample.exe", std::ios::binary); f.seekp(1169, std::ios::beg); f.write(reinterpret_cast<const char *>(&hex), 2); f.close(); …

Member Avatar for replic
0
238
Member Avatar for blahblah619

Can anyone help me figure out what I'm doing wrong. I'm new to programming and for my class we had to modify the program so that it reads its input from a text file and the output of the program should go to the screen -- only the input is …

Member Avatar for siddhant3s
0
271
Member Avatar for jeevsmyd

The following is a code that my teacher gave me .. I dont know the working of files in c++ :( this program is supposed to copy a datafile into another.. but its is not working ... many many errors.. fname1 and fname2 are already existing files,right? or fname2 is …

Member Avatar for siddhant3s
0
107
Member Avatar for cppnewb

Hi. I'm making a class in an include file. I ran into some touble...When i try to compile, this is what comes up: [CODE] c:\...\renew.h(25) : error C2660: 'localtime_s' : function does not take 1 arguments c:\...\renew.h(36) : error C2660: 'asctime_s' : function does not take 1 arguments [/CODE] Here …

Member Avatar for cppnewb
0
1K
Member Avatar for gyagyus

Hi! I need to find out the size of an arbitrary file and then binarize it in C. I can do this with txt files, but how could I generalize it? This is how I get the size: [code] const char* filename = argv[2]; ifstream messageFile(filename); beginFile = messageFile.tellg(); messageFile.seekg …

Member Avatar for gyagyus
0
108
Member Avatar for nirav bhatt

[CODE] #include <cstdlib> #include <iostream> #include <string> #include <math.h> #include "utils.h" #include <float.h> #include "onboostnn.h" //using namespace std; /* Constructor function. This sets the training example file and number of base models. It also sets to NULL other variables to be used later. */ onboostnn::onboostnn(datafile* examples_to_train, long new_num_base_models, int new_num_epochs, …

Member Avatar for ArkM
0
121
Member Avatar for lesodk

Hi, i want to read some lines to an output text file in a loop. My problem is, that i want to start clearing the text file and then append to it in a loop. At the moment i use: ofstream file; file.clear(); file.open("book.txt", ios::app); for (map<string,Person>::const_iterator it = adrbook.begin(); …

Member Avatar for MosaicFuneral
0
244
Member Avatar for Argo54325

Ok, something very wrong is going on with my program. When i run it the numbers it is giving me are sometimes right but are also wrong. H (the first letter in the word) is both = to 0 and 1 (wtf?). Any ways below i'll show you want i …

Member Avatar for VernonDozier
0
1K
Member Avatar for rickster11

Ok, stuck on homework. The program is supposed to read a list of presidents from a binary file and display them. I have it all working..except..when it gets to Truman...it just keeps repeating his information. I know its still going in the loop, but for some reason the pointer stays …

Member Avatar for rickster11
0
146
Member Avatar for Argo54325

Ok so i made a decoder for this that gets the letters from the numbers that this encoder gets. Problem is that i think the numbers its giving me are wrong and i can't seem to figure out whats causing the problem. Help please! :( [CODE=C++]#define _CRT_RAND_S #include <iostream> #include …

Member Avatar for Argo54325
0
107
Member Avatar for Argo54325

When i runt he code and try to get the size of the 2 files something goes wrong with the msgIn file. I'm using the same method for both files and the bookIn will work but msgIn just returns 0 as if it never ran. this is the method that …

Member Avatar for Salem
0
139
Member Avatar for skitzo315

I need some help with Binary I/O. I know how to do it when I am specifying the filename in the code ie: [icode] fstream fio("persons.txt", ios::in | ios::out | ios::binary | ios::trunc); [/icode] What I need to know is how to open or create a file with a file …

Member Avatar for siddhant3s
0
314
Member Avatar for Se7Olutionyg

[CODE]#include <iostream> using namespace std; #include <iomanip> #include <cstdlib> enum RequestType { ZERO_BALANCE = 1 , CREDIT_BALANCE, DEBIT_BALANCE,END} int getRequest(); bool shouldDisplay ( int, double); void outputLine ( int, const char*const, double); int main () { ifstream inClientFile( "clients.txt", ios::in); if ( !inClientFile) { cerr << " File could not …

Member Avatar for Se7Olutionyg
0
141
Member Avatar for rickster11

Each time the program goes through a loop, nameField gets bigger and bigger. Strcat keeps adding new names to the field. How can I clear the field after each output? I thought it was something like nameField = {' '};...but that doesn't work. There has to be a simply way …

Member Avatar for rickster11
0
144
Member Avatar for skitzo315

I have a person class which writes a name and age to file using binary I/O. By default I need it to create 10 slots for 10 people each set to "null" for name and 0 for age. Then it asks if you want to modify a record and if …

Member Avatar for Ancient Dragon
0
154
Member Avatar for delerium12345

I'm having a lot of problems writing a program to open a file listing the grades of 4 students, all listed next to their names, and outputting an appended version of the file with the average of the scores next to the numbers on each line. it goes something like …

Member Avatar for h3xc0de
0
85
Member Avatar for chetan_8187

I have the following code it works for mpg files But it grabs every frame of video I want to grab Single particular frame or/at particular time plz help me and post the modified code Its urgent Code: import java.awt.*; import javax.media.*; import javax.media.control.TrackControl; import javax.media.Format; import javax.media.format.*; import java.io.*; …

Member Avatar for chetan_8187
0
512
Member Avatar for gshock2006

Hi,guys, I am new to C++,and recently I practice to read a file with visual studio 9.0,but it turns out that it cannot find the very file! [code] #include<iostream> #include<fstream> #include<string> #include<iomanip> #include<cstdlib> #include<vector> using namespace std; //using namespace stdext; int main() { ifstream inClientFile("Dic.dat",ios::in); if(!inClientFile) { cerr<<"File could not …

Member Avatar for gshock2006
0
245

The End.