2,025 Topics

Member Avatar for
Member Avatar for brixton

Hello, I've got the following code: [code] wxString path = filepath; wxString newpath = filepath; fstream f(path.Append("/tests/tests.bin"), ios::in | ios::binary); fstream fnew(newpath.Append("/tests/temp.bin"), ios::out | ios::binary); Test* transferTest = new Test(); int thisSize = sizeof(Test); bool success = false; bool toBeDeleted = false; int testNo = 1; if (f) { f.seekg(0, …

Member Avatar for brixton
0
111
Member Avatar for maddy05

this is a project made by me but its issue function is not working well instead of modifying and changing the value of issue to 2 it is adding another book with issue 2 in the file can some one correct it // **library management** // // **library members can …

Member Avatar for Murtan
0
246
Member Avatar for andyv

Hi all. I am trying figure out why the compiler is giving me this error message: error LNK2001: unresolved external symbol "double __cdecl calcWindChill(double,double)" (?calcWindChill@@YANNN@Z) HomeWork3.obj I've declared, defined , and called the calcWindChill() function. I've obtained the values needed to feed into the function. They're not getting put into …

Member Avatar for Ancient Dragon
0
217
Member Avatar for Faterin

I use this [code] #include <fstream> #include <iostream> using namespace std; class Student { public: char FullName[40]; char CompleteAddress[120]; char Gender; double Age; bool LivesInASingleParentHome; }; int main() { Student one; strcpy(one.FullName, "Ernestine Waller"); strcpy(one.CompleteAddress, "824 Larson Drv, Silver Spring, MD 20910"); one.Gender = 'F'; one.Age = 16.50; one.LivesInASingleParentHome = …

Member Avatar for damani88
0
257
Member Avatar for Jacky1

am trying to append to file but its not going correctly every time it fail to connect to file [code] #include<iostream> #include<fstream> using namespace std; int main() { fstream file; char word[256]; file.open("StudentInfo.txt",ios::app); //file.open("StudentInfo.txt",fstream::app); // wont work too if(file.fail()) { cout << " Error opening the file " << endl; …

Member Avatar for WaltP
0
125
Member Avatar for Dendei

Hi i got an problem i need to read from an text file that i got from an excel file at start. so i want each block in the excel file to have one space at the array i saved it so it got seperated by ; example: [code] 4 …

Member Avatar for Dendei
0
231
Member Avatar for cppnewb

I am having trouble using cin.getline and classes. Here is the code[CODE] #include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <fstream> using namespace std; class RememberPlans { public: string date; string subject; string resources; string description; }; RememberPlans nds; // Function Prototypes bool enterPlans(RememberPlans& nds); void exportData(RememberPlans& nds); void …

Member Avatar for cppnewb
0
414
Member Avatar for 1bennyd

Hi guys, I have written some C++ code to do three things: 1. Read data from a delimited file (user specifies type of delimiter used), and return data as a "2D array". 2. Print 2D array to console. 3. Write the 2D array to a tab delimited text file. I …

Member Avatar for d0pedup
0
153
Member Avatar for dvsConcept

Im getting these two errors, here is the whole code besides the edits and i know the edits works so their not important here. Error 6 error LNK2019: unresolved external symbol "int __cdecl loadArray(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const (* const)[2])" (?loadArray@@YAHQAY01$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main Q6_A1_CODE.obj Error 7 fatal …

Member Avatar for dvsConcept
0
134
Member Avatar for atish00

I have posted the update member function as many the 12th students can copy my project. I want to open the binary file compare the roll numbers with the inputted roll if it matches the object of the file should be overwritten with a new object i.e *X. [code] void …

Member Avatar for atish00
0
122
Member Avatar for abhi1

Hi Guys, Am trying to edit a file in C++. Am using TurboC++ (and have to stick to it only :P ). I have to functions, find_detail() and balance_update(). What am trying to do is find the position of balance in the file, store it in a int variable, then …

Member Avatar for guest7
0
406
Member Avatar for Bladtman242

this program is just messing around with file i/o, and then i stumbled across something that i¨ve clearly forgot or missed in the tutorials i've read. my 'guess' is its the to if statements messing up (or perhaps rather their else's) i know i used goto and that means i …

Member Avatar for Bladtman242
0
117
Member Avatar for michaelmorris

Hi, its me again, How would I go about reading in the same file twice?? What I need to do is read it in the first time, and count how many lines there are between two words (in the middle of the file somewhere - see example below), create and …

Member Avatar for michaelmorris
0
327
Member Avatar for Zach1188

This is my first C++ program that I put any serious effort into. You may have seen the trick that allows you to start explorer.exe as the SYSTEM user (by running "at /interactive xx:xx explorer.exe", adding 1 minute to the current time). It takes a lot of jumping through loops, …

Member Avatar for Murtan
0
117
Member Avatar for Swemp

Hi, I have a problem with the use of vectors. As you can see, the program asks the user for a row of positive whole numbers. These numbers will by put in a vector called "getallen". Than the numbers in "getallen" will be sorted by the function "sorteerint" and number …

Member Avatar for Ancient Dragon
0
159
Member Avatar for RhinomanUK

Hi I'm having a problem reading in a file. I am using BCB6 Personal Edition under Win XP. The file is always read correctly up to the 4413th byte then the data is corrupted. I have modified the code from a fixed array size to use a vector so I …

Member Avatar for RhinomanUK
0
180
Member Avatar for beast0000

Hello guys, I am new in this forum and i hope im gonna get some fast help. I have this problem where i should input numbers from a .doc file, and the program should output how many times the number of occurences of each number. ie: the numbers in the …

Member Avatar for MosaicFuneral
0
80
Member Avatar for aniruddha_may92

Hello guys, I'm making a C++ project on periodic table.In that,i want to search for elements on the basis of their names in such a way that if i give an alphabet or more than 1 alphabets as the search value then all the elements starting from that letter should …

Member Avatar for William Hemsworth
0
104
Member Avatar for Lukezzz

I have the ambition to make a List, Global so it can be reached within other Threads. When compiling the code with the declared list like this the compiler says: [I]syntax error : missing ';' before '<'[/I] Should I declare the List in any other way than this ? (The …

Member Avatar for Lukezzz
0
133
Member Avatar for sweeya

Hi i am trying to understand manipulators. Can someone explain what is happening here [code=C++] for (int i = 0; i < n; i++) { cout << setiosflags(ios::left) << setw(15) << item[i] << setw(8) << setprecision(0) << code[i] << setiosflags(ios::right) << setw(8) << setprecision(2) << setiosflags(ios::fixed | ios::showpoint) << cost[i] …

Member Avatar for grumpier
0
193
Member Avatar for Shinedevil

I have no idea how to make somthing like this, and i'm kind of new with file I/O. How would you start somthing like this? O.k. here is what I have to save, I have roughly 56+ variables that need to be counted in this. But what I am having …

Member Avatar for MosaicFuneral
0
128
Member Avatar for Shinedevil

I have no idea how to make somthing like this, and i'm kind of new with file I/O. How would you start somthing like this? O.k. here is what I have to save, I have roughly 56+ variables that need to be counted in this. But what I am having …

Member Avatar for daviddoria
0
140
Member Avatar for monere

Hello, Thouh i am 60 years old i am still a beginner in c++ and i need some directions from more experienced programmers. The following code successfully reads file clip1.txt. I want to replace the quoted file "clip1.txt" with an expression or a variable or a pointer as i have …

Member Avatar for monere
0
85
Member Avatar for rtmarch

ok so i am almost done with this assignment but i keep getting an error on line 51 about my function i am calling. please help me! [code=cplusplus] //calculate energy bill part 9ish // #include <iostream> #include <string> #include <iomanip> #include <fstream> using namespace std; int i; void sort(int[], int[], …

Member Avatar for Bench
0
85
Member Avatar for TriceD

Hi all, I'm fairly new to programming as a whole and so I would be grateful if you can help me out. I'm trying to write a program in VC++ or C++ that would intercept print jobs from another program and save this information in another file(to be formatted later). …

Member Avatar for TriceD
0
503
Member Avatar for gingo

Hi, i am in the process of trying to make a high scores table but i am failing miserably, i dont have a lot of experience in c++ and i was hoping i could get a bit of help trying to sort my code. [code]#include <iostream> #include <fstream> #include <string> …

Member Avatar for gingo
0
182
Member Avatar for J4YP33

I am trying to open a file after getting its path from the user. here is the code. [CODE]#include <iostream> #include <fstream> #include <string> #include <cstring> using namespace std; void main(){ const char* filepath; string input, input2; char lines[110]; ifstream infile; cout << "Enter filename (including path): "; getline (cin, …

Member Avatar for J4YP33
0
240
Member Avatar for Holy Roller

Hey, I'm somewhat new to programming in c++ and I have had this code I wrote for a long time now. I wrote this about 9 months ago when I was really interested in learning the c++ language but lost interest during the summer. Well, now I'm getting back into …

Member Avatar for VernonDozier
0
121
Member Avatar for brixton

Hello there, I'm learning file I/O in c++ ATM and I'm getting a strange problem when I'm (at least I think so) following a tutorial. What I'm doing is simply writing a User object to a file and then read that same object from the file. I'm doing this just …

Member Avatar for Lerner
0
176
Member Avatar for Seamus McCarthy

Hey can anyone offer me any advice on updating my customer file, I created the blank records and can create a record in the newCustomer function but can’t seem to access that record again for updating, does anyone know where I’m gone wrong. Any help would be greatly appreciated. [CODE]fstream …

Member Avatar for ku.bis
0
166
Member Avatar for piznut25

[CODE]/* Filename: odometer.cpp * Author: Tom Pizzo * Email address: pizzotm@clarkson.edu * Description: Program to track fuel and mileage for an automotive vehicle. * Last changed: Dec 1, 2008 */ #include <iostream> using namespace std; const char YES = 'y'; class Odometer { public: Odometer (); //Constructor function to initialize …

Member Avatar for cikara21
0
138
Member Avatar for clutchkiller

Hi guys, im still learning some programming, and am confused on the subject of file i/o. I am getting this error but cant figure out why. Any help is appreciated, thanks Keep in mind i have obviously not finished the case scenarios. In function `int main()': error: jump to case …

Member Avatar for cikara21
0
217
Member Avatar for robgeek

I am trying to read a file from fstream in a switch statement but something in the code seems to be stopping this part of my code to be read by the compiler. Please some one let me know what am I doing wrong. Its not the text file thats …

Member Avatar for robgeek
0
302
Member Avatar for rtmarch

so i have been sitting here for about 2 days finishing this thing and i still have one error left and i am having a hard time fixing it 1>k:\c++\energy bill part 3\energy part 2.cpp(119) : error C2059: syntax error : ';' here is my code thanks for your help …

Member Avatar for TheBeast32
0
125
Member Avatar for rtmarch

ok so i got my code done but my logic in my code is off and my outputs are not coming out the way they should. so the following is a notepad file which is being read into my program 1231 washington, george 300 3431 adams, john 600 5767 jefferson, …

Member Avatar for vmanes
0
118
Member Avatar for robgeek

Hi everyone, I have worked some more on my code and this time I am getting some error that I am not able to resolve. Please help me. The error says: "initialization skipped by case label." Please show me how to resolve this. Here is the code. The error has …

Member Avatar for robgeek
0
4K
Member Avatar for anupamsps

hi friends; i am trying to build a class using multimap, the idea is something like this: I have say N no of particles and each particle has fix position in 3d space something like this: Coordinate: Particle level (1,2,3) ----------------> 1 (1,2,3) ----------------> 7 (1,0,0) ----------------> 2 (0,0,0) ----------------> …

Member Avatar for StuXYZ
0
179
Member Avatar for Fouly

Hi all, I'm a beginner at Open Watcom and i'm trying to R/W from and into a file...i used the library "fstream.h" but the scanner shows invalid token... [code] #include <stdio.h> #include <string.h> #include <iostream.h> #include <fstream.h> int main() { ifstream inFile; // object for reading from a file ofstream …

Member Avatar for cikara21
0
190
Member Avatar for sting23

#include<fstream.h> #include<iomanip.h> #include<conio.h> #include<iostream.h> #include<stdlib.h> #include<string.h> #include<time.h> #include<iomanip.h> //-----------------------------------------------------------------\par \par \par class inventory\par \{\par \tab char name[25];\par \tab int code,copy;\par \tab float cost;\par \tab char stock[3];\par \tab char datestr[9];\par \tab char timestr[9];\par \par \tab public:\par \tab\tab void rdata(void);\par \tab\tab void wdata(void);\par \tab\tab void menu(void);\par \tab\tab void display(void);\par \tab\tab void mainpage(void);\par …

Member Avatar for mrboolf
0
144
Member Avatar for drjay1627

Can some one help me with this error: =========================================error================================ In file included from /usr/include/sys/signal.h:34, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/pthread.h:22, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/sparc-sun-solaris2.6/bits/gthr-default.h:37, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/sparc-sun-solaris2.6/bits/gthr.h:98, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/sparc-sun-solaris2.6/bits/c++io.h:37, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/bits/fpos.h:44, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/iosfwd:46, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/ios:44, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/ostream:45, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/iostream:45, from main.cpp:1: /usr/include/sys/siginfo.h:259: 'ctid_t' is used as a type, but is not defined as a type. /usr/include/sys/siginfo.h:260: 'zoneid_t' …

Member Avatar for Lerner
0
256
Member Avatar for rumencho

Hi all. I want to learn how to manipulate .txt files through C++ program. I want to be able to search trough chars in .txt file,sort them etc. I think the best way for this,should be,loading .txt file in char array and then manipulating the elements. but I don't know …

Member Avatar for ArkM
0
154
Member Avatar for Lokolo

[code] void writingTransactionToFile(string transaction) { string temp; int test; ifstream myfile("transactionlog.txt"); ofstream tempfile ("tempfile.txt", ios::app); if (tempfile.is_open()) { tempfile << transaction; if(myfile.is_open()) { while(!myfile.eof()) { getline(myfile,temp); cout << temp; tempfile << temp << endl; } } else { cout << "Unable to open file."; } tempfile.close(); myfile.close(); } else cout …

Member Avatar for brechtjah
0
173
Member Avatar for shankhs

I was trying to write a program that takes an input from a file which is located in Desktop not the default directory where the program is saved [code] #include <iostream> #include <fstream> #include <stdlib.h> using namespace std; int main() { ifstream fin; string str="C:\Documents and Settings\shankhs\Desktop\ccs\Assignment CCS.txt",temp=""; cout<<str<<endl; for(int …

Member Avatar for shankhs
0
145
Member Avatar for clutchkiller

My dev-c++ compiler is telling me that ios::noreplace is not a valid member of std::ios. Why?

Member Avatar for clutchkiller
0
95
Member Avatar for christiangirl

Hello, I'm having trouble with this program. What I have to do is open a file(in this case link.dat) and then the user chooses what they want to do, take something out of it, add somethng to it, print it. It opens the file fine, but then I cant get …

Member Avatar for christiangirl
0
94
Member Avatar for clutchkiller

Hi guys, right now I am an amateur in the world of programming and am starting to "train" myself by thinking of ideas for a program and figuring out how to write it. So right now, my first real undertaking I have devised is to write an itemizer where the …

Member Avatar for Nick Evan
0
113
Member Avatar for Briterican

Hi, I'm a newbie to this site, but I will soon be an active member. Currently I'm writing a program where one of my methods has to read data from a text file and set it to an array. I then need to display that data in the console, but …

Member Avatar for WaltP
0
113
Member Avatar for sagar_d

[code=cplusplus] template <class T> void trace(LogBuffer& msgBuffer, T& data) { data.trace(msgBuffer); } [/code] In the above template fuction we are using a generic class T, but when we are compiling on gcc4.1.3 compiler we ar getting the following error. error:request for member 'trace' in 'data', which is of non-class type …

Member Avatar for Alex Edwards
0
102
Member Avatar for clutchkiller

When [code] using namespace std; [/code] are you able to overwrite it for a specific line e.g ios::app while using the fstream header? or does that mean i have to use std:: on everything else? thanks

Member Avatar for clutchkiller
0
82
Member Avatar for Alex Edwards

I remade an equation-solver program from Java to C++, and I plan to post it soon but I would rather not until I can determine where modulus fits in with PEMDAS. To those who don't know, PEMDAS is the order in which mathematical expressions are to be evaluated. The order …

Member Avatar for Alex Edwards
0
7K

The End.