2,025 Topics
![]() | |
So I've only been programming for a few weeks, and I thought that I'd learn how to program by converting a rather complicated baseball board game to a program. I'm writing a preliminary program that stores player information from a card into a random access file. My Struct holds the … | |
Hello all, I know there is a "sort" method in the STL for list. However I am not sure how to use it, and my research was unable to help me out. What I am trying to do is sort my master list by the averages, lowest to highest. Can … | |
Hi all. I am trying to read items from a text file whose name is input by the user and also output the receipt to a text file whose name is input by user. I got stock for about 3 hours. Could you guys help? Thank You. [CODE] #include <iostream> … | |
Hi Everybody I am new to C++ and have a problem from the book my instructor gave that I am having some problems with. I am sure you guys are all familiar with the "mortgage calculator" here is my code. The Errors I am getting are as follows. I have … | |
Hello all, So I am new to the whole STL List class, and I am a little confused. In the past I have always had two classes, a data class and a "linked list" class. So now I have a bit of a pickle when I try to make a … | |
I've made a simple webserver in C++ based on this one [URL="http://http://msdn.microsoft.com/en-us/library/ms737593%28v=VS.85%29.aspx"]here[/URL]. And this works fine. Now, my assignment is to pass some info from this server to an html-file that later can be opened in IE or Firefox and then display info like screen resolution. Now.... This is supposed … | |
I'm attempting to recreate the Unix shell program "todo.txt" using C++ on Windows. An example use of my program in the Command Prompt would be: [CODE]>todo /A "I like cheese."[/CODE] which would append the item "I like cheese." to the file "todo.txt". In my program, there is a line which … | |
Hi all. I am trying to create a program to take in records of a companies payroll. I get the data then write it to a binary file. When I want to delete a record I ask for the specific timesheets name and the employee ID then read the file … | |
I'm taking an advanced C++ class now, and everything up to now has been pretty simple (mostly review stuff), but now we got to binary file io and it's kicking my butt. This program is supposed to read from a file called "Hardware.dat" (or create it if it doesn't exist), … | |
Hi, I'm working on a linked list filled with class objects and I've encountered a weird problem that I cannot see how to resolve. I declare 2 self-referential pointers within my 2 classes and the error: In file included from prog2.cpp:16: employeedatalist.cpp: In function âvoid getData(std::fstream&)â: employeedatalist.cpp:15: error: âheadâ was … | |
Here is the problem from my Programming class: Write a program that asks the user for two file names. The first file will be opened for input and the second file will be opened for output. (it will be assumed that the first file contains sentences that end with a … | |
i would never ask for debugging help usually but i am totally lost and have wasted far too much time on this. both peices of code compile correctly. the original function works fine with my program and the second one crashes. the original code checks a textfile in the root … | |
[B]I'm new to C++ and I need help in writing code:[/B] Lucy likes to jog in the morning. As she jogs, she counts the number of strides, she makes during the first minute and then again during the last minute of her jogging. She then averages these two numbers together … | |
![]() | error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ifstream' 1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string(527) : see declaration of 'std::getline' [CODE]void read() { Inventory items[100]; string line; int i=0; ifstream inventdata; inventdata.open("Inventory.dat", ios::in); if( !inventdata ) { cout << "ERROR: Unable to … |
[CODE] #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main () { int numb, sum, divis3, divis5; numb = 20; sum = 0; double value = sqrt(numb); cout.setf(ios::fixed,ios::floatfield); cout << setw(8) << left << "NUMBER" << setw(8) << left << "DIVIS3" << setw(8) << left << "DIVIS5" << … | |
Hi ~ Just found DANIWEB while researching ios format flags...Programming is new to me though this is my second programming class (C++). My first was VB I. Things were going along swimmingly until our book introduced flags for formatting : ios::std:: etc.... Well the book did NOT introduce these flags...they … | |
I use Visual Studio 2005 on windows XP. I'm trying to use "Google Test" framework. But i couldn't manage to make just one test because of linker errors. I built Google Test, thank created new project. Then made the steps written in [URL="http://stackoverflow.com/questions/531941/how-to-setup-google-c-testing-framework-gtest-on-visual-studio-2005"]this link[/URL] to the project properties file. Than … | |
hi to all, can anyone tell me about streambuf and filebuf classes...i got to know that ios contains a pointer to streambuf....so it must be something important ,right?..... | |
I really don't know how to capture the information from the bitmap file when talking about the pixelArray, I know what I have to do it when I capture it to turn it negative, but each time I run my code it crashes when I run the code I think … | |
Hi there, in my binary file i want read something but from 4th byte. i need to read data as 2 bytes int. i have this code but im not sure if its ok: some of my files should have some values less than 0, and im not getting any..so … | |
hiiiii its 12th science student.IN THE FOLLOWING PROGRAM I REALLY DONT UNDERSTAN THE LINKER ERROR.I HAD ALREADY SPEND 4-5 HOURS IN SOLVING 50IES OF ERROR BUT THIS ERROR I REALLY DON'T ABLE TO UNDERSTAND. SO PLEASE HELP ME OUTTTTTT. AS EARLY AS ANYONE CAN...... [code]#include<string.h> #include<iostream.h> #include<conio.h> #include<dos.h> #include<stdio.h> #include<fstream.h> … | |
Hello. The problem with the following code is that when I read from a file after restarting the program and then try to display the contents, it goes into an endless loop. I hope that someone can point out the logical error hiding there. [CODE]#include <iostream> #include <windows.h> #include <fstream> … | |
I am writing a program to make pictures into their negative. But I do not know how to open the bitmap file, I don't know if I should open it as a binary, when I try to my security coding kicks in, and when I open as ios::out my security … | |
i [COLOR="blue"][/COLOR]I am geting fatal error help me [CODE]/* The United Bank makes certain computerized facilities in their bank to implement customer records and their daily daily transaction records. The bank keeps certain information as follow: INITIAL.dat: acc_no : Account number name : Name of the Accountee address : Address … | |
Pretty much what it says in the title, _orgDrspath = std::string, newDrsName = std::string [CODE]std::cout << "Opening original " << _orgDrsPath << std::endl; // Store all bytes into a variable called exe std::ifstream inFileDrs(_orgDrsPath, std::ios::in | std::ios::binary); inFileDrs.seekg(0, std::ios::end); size_t len = inFileDrs.tellg(); int newLen = 1024*1024; char *theDrs = … | |
Hi, I am trying to write a simple c++ script to learn more about file manipulation. First script is adding some info a file as a structure and second one is reading from the file. However when i try to read from my file it always shows the found values … | |
I am compiling my two .cpp files that are linked with header file. i am getting the error ~/...>g++ -o test.exe diamondtest.o main.o Undefined first referenced symbol in file Diamond::Diamond(int) main.o Diamond::Diamond(int, char) main.o ld: fatal: Symbol referencing errors. No output written to test.exe collect2: ld returned 1 exit status … | |
First of all, Im not too good at c++. so please take it easy on me. I try to change the password but i only want to change a certain password in the text file.But when the text file got re-write like only one new password exits. the whole file … ![]() | |
Okay, I was given a picture in bitmap format and a very brief explanation on seekp and seekg. And was told to write a program. I am supposed to make overwrite the image as its own negative and output in binary. I don't know where to even start, I know … | |
Hello out there, I am trying to compile some simple code but am running into a weird error that I can not figure out terminate called after throwing an instance of 'std::ios_base::failure' what(): basic_ios::clear Aborted This is happening when I do an Infile>> read in the code below. What I … | |
[COde]#include <iostream.h> #include <fstream.h> #include <process.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <conio.h> #include <dos.h> int pass(); void abt(); void start(); int pass() { char a[750],b[500]; clrscr(); textcolor(BLUE); textbackground(LIGHTGREEN); clrscr(); cout<<"\n\n\tENTER YOUR LIBRARIAN USER NAME\n\n\t"; gets(a); if(strcmp(a,"LIBRARY001")!=0) { cout<<"\n\tSORRY FOR THE INCONVIENIENCE,YOU HAVE NO ACCESS TO THIS … | |
how do i include classes in my code. my lab notes say i need to include classes. [code] #include <iostream> #include <string> #include <stdlib.h> #include <cstdlib> #include <fstream> using namespace std; void login(); void Members(); void PassChange(); string inuser; string inpass; string user; string pass; string tempass; string data; string … | |
logmsg.h [CODE] void LOGMSG(string logmsg,...)//... { stringstream name; name<<"test "<<TM.years()<<"-"<<TM.month()<<"-"<<TM.day()<<".log"; ofstream log; log.open(name.str(), ios::out | ios::app); log <<TM.hour()<<":"<<TM.mint()<<":"<<TM.sec()<<" Message: "<< logmsg<<endl; } [/CODE] main.cpp [CODE] int main() { int a = 100; LOGMSG("type test!!",a,"times"); }[/CODE] but it's only wtite into the file "type test!!" while i want it to type … | |
Need to read 4 bytes into a long int format. Both inFileDrs and outFileDrs are in ios::binary form. Is this the correct way to do this? The original piece of code was [CODE]var tableCount = reader.ReadUInt32(); writer.Write(tableCount);[/CODE] [CODE] unsigned long int tableCount, firstFilePos; inFileDrs >> tableCount; outFileDrs << tableCount;[/CODE] | |
[ATTACH=right]15517[/ATTACH]If you cannot wait to get hold of the new iPhone 4, should you have been lucky enough to have successfully pre-ordered, then you could always upgrade your existing iPhone 3G/3GS to iOS 4 and get many of the same features. Be warned, though, the update itself is not without … | |
Hi.. Could anyone help me to find out why this program cannot count the frequency of each alphabet? There is a output for calculating the total lines and length but not the frequency.Appreciate any help. Thanks! [CODE] int main() { const int MAXLENGTH=10; const int MAXCHARS=10000; static double i[26]; char … | |
Dear all I have the following code [CODE] void initializeData() { Customers *CustArray; CustArray=new Customers[150];//allocate 150 memory locations of class Customers Flights *FL=new Flights[150]; } /*End Initialize Data fuction*/ /**********************************************************************************************************************************/ /*Backup Menu implementation*/ void backupfiledefaultfilename() { ofstream file_ptr; // Declares a file pointer. file_ptr.open(“backup.bak”, ios::out); if (!file_ptr) { cout << … | |
i have written a program in c++ using the concept of file handling. this program is about managing a basic electronic hardware store stock and showing the sales report. i am not able to understand why the [B]contents of my file are not being displayed, modified, deleted, or even printing … | |
Hi, I have a text file with characters. I must able to read the length of characters in the file by every line and count the frequency of each characters for each line. I have tried on writing this program but this does not work. Can anyone help me on … | |
When I was studying computer programming in college many years ago, I didn't imagine that our work could impact lives, particularly in a negative way. We've heard reports (mostly true) of death, dying, and destruction as a result of software problems, such as the time a plane flew right into … | |
Dear all, I need your help on tis programming assignment I have. I need to save all the atrributes information to a signle file. I need to have 2 options : Save to a default name backup.bak and to a users filename choice. I have found this code in an … | |
Hi. I want to read a file and scan the file to see if the file contains 0x000001 (24 bits, 23 zero and 1 one bit). if file contains 0x000001, return a "yes", else return a "no". I tried writing the program but cannot work. I am stuck with this … | |
This brand new update to the ever popular TomTom for the iPhone app (which has featured in the Apple 'top grossing apps' list since it was first released 18 months ago) adds one highly requested feature: Map Share. Why the big hurrah over one additional feature? Simple, it's a hugely … | |
Using Borland 4.5, yea its old but this is what my teacher prefers. Problems States: Markup Write a program that asks the user to enter and item's wholesale cost and its markup percentage. It should then display the item's retail price. For Example If an item's wholesale cost is 5.00 … | |
I have a function below which is supposed to read from a continuous updating file...by another program. for this reason I used a fileptr int to keep track of the last known good read so this index value is updating correctly but it is not being used by getline. and … | |
Hello, Im writing a banking system program for one of my assignments using classes, i've got the some basic stuff done but I can't for the life of me work out how to read data out of a file i've previously created and display it on screen. (I've cut the … | |
Using Borland 4.5 I think I got most the program done but its hard for me to setup functions with returning names and values. Problems States: Winning Division: Write a program that determines which of a company's four divisions (Northeast, Southeast, Northwest, and Southwest) had the greatest sales for a … | |
Hi all. I need to code an offline crawler that acts like a web crawler on a set of given html pages. I know how to read the a=href tag and output those links to the screen. My plan is to modify my code to add more functionality. Instead of … | |
Hello my friends, I'm getting new types of ignorance from new iOS SDK. (xcode 3.2.5). I always wanted to have my own gameloop. here is the some part of it. [ICODE] - (void) gameLoop { //get all touches while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002f, TRUE) == kCFRunLoopRunHandledSource); //Update logic: UpdateLogic(); //Render Frame Render(); } … | |
I'm finding issue with my current program. I built the program so that it reads an input code from a file and it is also supposed to display only the code's appropriate salary. However, for some reason, everything I've tried only results in all the salaries being pulled together, not … |
The End.