2,025 Topics
![]() | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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, … | |
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 … | |
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++ … | |
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. … | |
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 … | |
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> … | |
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, … | |
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 … | |
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 … | |
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 … | |
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: … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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; } } … | |
[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 … | |
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 … | |
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 … | |
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(); … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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, … | |
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(); … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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.*; … | |
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 … |
The End.