2,025 Topics

Member Avatar for
Member Avatar for Princequarles

Hi all, I have a problem reading data from my file for example this is my textfile CODE MARKER //Names of columns in my table PKY KELLYS ELM ELMANS OOC OLIVER QRT QUATAR A user is asked for code, when the code is entered, the corresponding name is displayed eg …

Member Avatar for Salem
0
107
Member Avatar for Cosa

Here is my code, the aim is to use dynamic memory and pointers. The program siccesfuly reads in data from a text file into the dynamic array(matrix). The size of the array is also in the text file, so thats how the size of the array is known. I am …

Member Avatar for Cosa
0
241
Member Avatar for c++noobie

I am currently using Kubuntu 8.04. Although I do not know any bash, I altered the bash shell (via internet guides) to append history instead of truncating the history file. After editing the shell, the default way to clear the history only clears the interactive history and not the actual …

Member Avatar for c++noobie
0
155
Member Avatar for scream2ice

i'm trying to write a program that reads a text from the user(keyboard) sentence by sentence and then prints the 'morse code' of them char bay char on a text file. I'm just testing it for the letter 'c' to start with, but it doesn't seem to be working well …

Member Avatar for John A
0
101
Member Avatar for saint.h

[code=cplusplus] int Seats::AddEntry() { std::cout << "Please enter your desired seat position"; std::cout << endl; std::cin >> position; ofstream SaveFile("Traveler.txt",ios::in); SaveFile << "Your Seat postion is...:"; SaveFile << endl; SaveFile >> position; SaveFile.close(); return 0; } [/code] This is just a snippit of my code...This function is one of 3 …

Member Avatar for Ancient Dragon
0
285
Member Avatar for scream2ice

i have text file with a series of words in it. some word contain the expression '.zip' , i'm trying to rerad the characters of the file and replace the .'zip' with '.rar' this is my prog, bu it's not responding [code=cplusplus] #include <iostream.h> #include <fstream.h> #include<stdlib.h> #include<conio.h> void main() …

Member Avatar for scream2ice
0
155
Member Avatar for scream2ice

i'm trying to write a program that reads a text from the user(keyboard) sentence by sentence and then prints the 'morse code' of them char bay char on a text file. I'm just testing it for the letter 'c' to start with, but it doesn't seem to be working well …

Member Avatar for Ancient Dragon
0
129
Member Avatar for anjaliraman

Hi All, The CPU Utilization in my program is too high when I am trying to read a file. Can you please suggest a better method. Please find code snippet that I am using. [code=cplusplus] void SyslogReader::isTrapRaisedFromTestClient(list<SNMPTrapInfo>* pListSNMPTrapInfo, const int nSemID) { int nWaitCount = 0; const int SYSLOG_MAX_MSG_LEN = …

0
38
Member Avatar for David Wang

[B]Game I am about to make:[/B] Coins are randomly drawn from a set of possible coins and arranged in a line. Two players alternately remove and collect a coin from either end of the line. The game ends when all the coins are removed and collected by the two players. …

Member Avatar for David Wang
0
132
Member Avatar for Phan

Hey, everyone, I am another student seeking help for a programming class. What I am having trouble with specifically is reading from a file. The program itself involves entering in some store products with information such as: product name, product ID, etc. After everything is entered, the program is supposed …

Member Avatar for vmanes
0
109
Member Avatar for jimJohnson

I am working on a program with function files and I am not sure how to ask this so this might be kind of interesting. We were given an input file that I saved to my desktop. This is all I did with it and I am not sure if …

Member Avatar for jimJohnson
0
146
Member Avatar for super star 90

please help to with this program by mainly using arrays and pointers ,... i need this program to check 2 matrix files "if they contain any character and if they contain cout<<"invalid"; " and to open them from .txt file Help with Code Tags cplusplus Syntax (Toggle Plain Text) [code] …

Member Avatar for Ancient Dragon
0
72
Member Avatar for BOTnPAID4

I wrote a program to calculate a loan, the program compiles and works fine, but I get an answer I do not understand. The answer comes out "$1.#J". I am pasting the code here I am using, I am not worried about the code it is a pretty simple set-up …

Member Avatar for Ancient Dragon
0
120
Member Avatar for David Wang

[B]Game I am about to make:[/B] Coins are randomly drawn from a set of possible coins and arranged in a line. Two players alternately remove and collect a coin from either end of the line. The game ends when all the coins are removed and collected by the two players. …

Member Avatar for Ancient Dragon
0
175
Member Avatar for moltenice

Assignment - [url]http://condor.depaul.edu/~ntomuro/courses/262/assign/hw2.html[/url] [code]Write a class called Loan, which simulates the money you borrow from a financial institution, and a main function (i.e., an application program) which tests the class. You write ONE file, which should be named "myLoan.cpp". 1. Class Loan The class Loan should have the following members: …

Member Avatar for Agni
0
277
Member Avatar for Moporho

I am trying to solve a problem from a lab challenge. I can not get the program to compile correctly. Please look over and let me know where I need to be looking to solve this Use a two-dimensional array to solve the following problem. A company has four salespeople …

Member Avatar for Moporho
0
4K
Member Avatar for navamous

I have to program an Address book program in C++. So far I've done about 40% of the assignment. The main requirements of the Address Book are the following (Which I am confused about are): 1. Display 20 Contacts at a time, using the space bar to go to the …

Member Avatar for Spagett912
0
219
Member Avatar for zaza_thegreat

please help to with this program by mainly using arrays and pointers ,... i need this program to check 2 matrix files "if they contain any character and if they contain cout<<"invalid"; " and to open them from .txt file [code=cplusplus] #include<iostream> #include<fstream> #include<string> #include<cmath> using namespace std; int main() …

Member Avatar for Nick Evan
0
217
Member Avatar for Lensva

hey again, code below works but it tends to give some info which shouldn't be there: (for example a - 0 where 'a' is a letter and 0 is the times the letter was repeated) [code=cplusplus] #include <iostream> #include <stack> #include <fstream> using namespace std; int main() { fstream fin1("E:\\iras.txt", …

Member Avatar for Lensva
0
208
Member Avatar for hsma

I am currently working on a mini project for my class. the project is designing a game called etch n sketch. you first etch out a map then quit the game after youre done. then sketch the etch you just created. the problem im having is the scoring system. score …

Member Avatar for vmanes
0
125
Member Avatar for code12

I'm having problem with this code. Here's what I'm trying to do. I want the user to enter the firstname, last name of the person whom he wants to delete from the phonebook. then I try to compare the data entered by user with the names already stored on phonebook. …

Member Avatar for code12
0
135
Member Avatar for Jon Jon

Hi, I want to be able to use std stream objects to manipulate files, but some of the files are too big. I want to be able to do the folowing: >int64_t fileSize; >strm.seekg(0,ios::end); >fileSize = static_cast<int64_t>(strm.tellg()); >cout<<"File size is "<<fileSize; This code will output -1 if the size of …

Member Avatar for Ancient Dragon
0
82
Member Avatar for digital_ice7

why cant it work properly??? [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; int main(){ ofstream out;//create output stream int acc_num[10]; for(int x=0;x<10;x++) acc_num[x] = rand()%10; //generate account number char acc_file[600]; for(int x=0;x<10;x++) acc_file[x] = acc_num[x] + '0'; out.open(acc_file, ios::out);//create & open output file out << "PACKAGE ID: "; …

Member Avatar for Nick Evan
0
107
Member Avatar for UnnamedPlayer

Hello I'm a newbie at c++ and I'm doing a basic course in school at the moment. I have an assigment which unfortunately is impossible to complete with my knowledge (that is how it feels like at the moment anyway :'( ) . I'm not looking for someone to do …

Member Avatar for vmanes
0
94
Member Avatar for rje7

im building a telephone directory. and the code is given below. i am using file system to store the record which i get from the user. and then i should be able to do searching, deleting, sorting and other default telephone dir functions. so far i have been able to …

Member Avatar for Salem
0
87
Member Avatar for TheBeast32

Hi i have been making two programs: one that sends a file's filebuf made into a char*, and another that receives that and writes it to a file. They're like exe sending programs. I can send the char* and write it onto the console using cout.write(), but when I try …

Member Avatar for TheBeast32
0
241
Member Avatar for TheBeast32

Hi, I made a simple program that copies files. I tried to copy an exe file, but after I tried to run the copied version, it doesn't work properly. Please help:?: Here's the code for the test file to copy: [code=C++] #include <iostream> int main() { std::cout << "Hello!"; std::cin.get(); …

Member Avatar for TheBeast32
0
177
Member Avatar for GPXtC02

i'm looking to get a first name followed by four scores and finally a last name, stored into multiple arrays (a char *array, a float array, & a char *array). getting the scores i understand however the names are pointer arrays. as far that goes what am i doing wrong …

Member Avatar for vmanes
0
494
Member Avatar for jmines

I am new to streams and files in C++. I am having a problem in this code. When i run the program, and after entering the password, a message is displayed "error opening infile". Why the program is not reading from the file or opening it? [CODE]#include<iostream> #include<string> #include<fstream> #include<iomanip> …

Member Avatar for jmines
0
101
Member Avatar for rzr.copperhead

hi all guru, here, my problem is re-running the program, the vector attribute of Service Class was listed unreadable characters.. WHY?? Below is my following code : Service.h code: [code] class Service{ protected: char servType[100]; vector<Medicine> vecMedicine; // the purpose that i created a vector attribute is a service can …

Member Avatar for Ancient Dragon
0
202
Member Avatar for dgg32

Hi, everybody. This is my first day here. And I create a new account because I hope to learn more from you. Here is the my task. I have a text file, it contains a DNA sequence. I want to fragment it into sequences with a definitive length into a …

Member Avatar for dgg32
0
104
Member Avatar for rzr.copperhead

i compile this code in Microsoft visual studio C++. No errors.. but i cant save the file.. why ?? [CODE] #include <iostream> #include <vector> #include <fstream> #include <conio.h> using namespace std; using std::vector; class Service { public: Service( string d ) { strcpy(servDate,d.c_str()); } void setDate(string d) { strcpy(servDate,d.c_str()); } …

Member Avatar for rzr.copperhead
0
120
Member Avatar for lookforlohith

#include<iostream> #include<fstream> #include<iomanip> using namespace std; class lohi { int x; int y; public : lohi() { x=10; y=20; } }X; int main() { fstream io; io.open("just1",ios::in | ios:: out | ios::app); io.write((char*)&X,sizeof(X)); io.close(); } in this programme i expect a file to be created and contents of x,y to …

Member Avatar for ivailosp
0
113
Member Avatar for R3B3L

I need help storing data in archives, I always get an unhandled exception when i try... [code=c++] #include"Inventory.h" #include"CustomerTransaction.h" #include <fstream> using namespace std; CarInventory* car_list; int main() { SLL<Customer>* customer_list = new SLL<Customer>; car_list = new CarInventory(); fstream file; file.open("Models.txt", ios::in); if (file.fail()) { cout << "\nFailed to open …

Member Avatar for Salem
0
84
Member Avatar for code12

Hi guys! I have started writing a program for phonebook which will add, delete, search, display and sort the information of a person. information will include firstname, lastname & phonenumber. now I was testing the first part of the program which adds a contact. but my loop is not doing …

Member Avatar for VernonDozier
0
244
Member Avatar for tootypegs

Hi i have my code that finds every instance of my search criteria in a text file and tells me the position in the text file it is located at. The next step i want to do is stream the bytes that follow each instance of my search criteria into …

Member Avatar for vijayan121
0
142
Member Avatar for kartouss

Hello, I am having a problem to call a function I am posting the code... Can anyone help how we can solve the problem... [CODE]int AES(string path1, string path2) { ifstream myfile1 (path1, ios::binary);// error ofstream myfile3 (path2, ios::binary);//error } int main() { AES( "c:/plaintext.txt" , "c:/cipheretxt.txt" ); return 0; …

Member Avatar for kartouss
0
81
Member Avatar for TheFueley

How would I display an IP address from /var/log/wtmp? I know I could use utmpdump, but that's not what I'm going for. I have included bits/utmp.h and can display other members of the struct, but when i try to display the ut_addr_v6 member, I get a random hex address instead. …

0
77
Member Avatar for mikky05v

I'm a student enrolled in a University beginners programming course. The problem is: [B]Write a program capable of using month and day of a given date to calculate the number of days from january 1 that it represents. Make the program capable of computing values for as many as 20 …

Member Avatar for mikky05v
0
127
Member Avatar for Majestics

I HAVE AN ASSIGNEMENT IN WHICH I GET STUDENT DATA AND SAVE IT A SEPARATE TEXT FILE , THE MAIN PROBLEM IS THAT IT TAKE ALL THE VALUES BUT DONOT STORE VALUE OF SEM,ADD-NO AND BATCH . KINDLY PLEASE HELP ME . Coding is :- [code=cpp]#include<iostream.h> #include<conio.h> #include<fstream.h> struct stud …

Member Avatar for Lerner
0
57
Member Avatar for jimJohnson

For some reason when I compile my code the hypotenuse returns to just 0 and it returns an integer and not a double and was wanting to know if anyone had any suggestions........ [code=c++] #include <iostream> #include <cmath> using namespace std; double Calculate_Hypotenuse(int length_one, int length_two); int main() { int …

Member Avatar for gkbush
0
277
Member Avatar for knight fyre

I'm trying to create a parking lot system where users can enter and exit a lot. This lot should be kept on a file(s). My code compiles but my data doesn't write to the actual file. [CODE]void SYSTEM::parkProcess() { CARD IDcard; char lot; int id; string type; cout<<"Enter Parking Lot: …

Member Avatar for vmanes
0
141
Member Avatar for digital_ice7

i'm working on a banking system.....m stuck here....i dont know how to do this: 1.Their account should already have an amount of money for further processing. 2.All users are able to perform transactions such as withdrawal, deposit and check balance etc. 3.Each user will have a file or record to …

Member Avatar for mitrmkar
0
107
Member Avatar for digital_ice7

why cant i type in my address??? [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; const int maxstring = 120; typedef char stringtype[maxstring]; void newuser(){ system ("cls"); stringtype name; string type, id, cnumber, address; double amount; ofstream out; cout << "ENTER YOUR NAME: "; cin >> name; out.open(name, ios::out); …

Member Avatar for skatamatic
0
123
Member Avatar for dan9992

Im trying to read lines in from a txt file to write into another txt file but at the moment its only reading the first line. I need it to read 1 line at a time and store it to add to another txt file before reading the next line. …

Member Avatar for dan9992
0
84
Member Avatar for c++noobie

I have been doing c++ for somewhere between 1 1/2 and 3 months (I'm awful keeping up with time). I have a program (one of my first) that I have taken and added pieces to since I made it and it has come to be the piece of work it …

Member Avatar for c++noobie
0
2K
Member Avatar for MasterDucky

Here's this program i write to uppercase proper nouns in a file. It opens three files: 1. is the file to uppercase. 2. is a list of proper nouns to uppercase. 3. is a list for proper nouns preceeding words that excludes proper nouns to be uppercased. I rechecked it …

Member Avatar for MasterDucky
0
150
Member Avatar for cmoney12051

I suck at C++! like really badly, i just cant grasp it, and now i have to write a program for it that is suppose to input some values from a text file that would create like a gradebook thing. im also supposta use a void function, calculatedAverage to determine …

Member Avatar for cmoney12051
0
110
Member Avatar for ramrod

I am a new student of c++ and am having a hard time with a program. i have never used filestreams before and been getting an error from the compiler that i do not understand. it reads ['struct std :: string' has no member named 'c-string'] i dont know if …

Member Avatar for vmanes
0
101
Member Avatar for GPXtC02

What is wrong with this function? [code]// /////// // void GetData(int(IDs)[], float(Scores)[][4], int &i) { //GIVEN: One blank ARRAY, one blank 2D ARRAY, & a index variable. //TASK: Function retrieves data from open stream into multiple functions. Stores ID into one structure and all of the student's test grades into …

Member Avatar for GPXtC02
0
262

The End.