2,025 Topics
![]() | |
I am trying to count the number of each letter grade for a list of students and count how many are male and female and how many students there are total. The problematic section is: [code] int ItemType::CountItems(int& ACount, int& BCount, int& CCount, int& DCount, int& FCount, int& MaleCount, int& … | |
hi there i'm new here i hope you can help me through this homework i've read like 14 pages of topics about seekg and fstream.. and well.. they didn't solve my problem. my homework it's about creating a text file from "b to z" without the vocals, then reopen the … | |
ok so what im trying to do is to read some text from a file. Put them into an array. And count the number of characters in the text file using pointers to access the array. However, when i compile i get an error for this line [B]check = isalpha('*text');[/B] … | |
Basically this code serves to take in an input file and convert all the "<" and ">" into "<" and ">" respectively. This works however, I cannot get it to convert the rest of the .txt file into the output file. Right now, it just works with the very first … | |
I have a written a program for Dijesktra algorithm; But I encounter the run time error when the code returns "lp" value ... Runtime check failure #2-Stack around the variable 'parent' is corrupted please see the code Could some one tell me that how to solve this prblem thanks [code=cplusplus] … | |
I'm working on a movie class for a project. I think I've got it reading in movies from a file. I want to test it using the overloaded subscript operator, but the Driver file will not let me enter a movie title to search for. I can't think of a … | |
I'm having trouble with a program with class. When it runs, on the screen and on the file it shows one output, the last one in the input file. It USED to work, untill I tried to get fancy and add some other code... that will be below the main … | |
Okay, I know I probably can't stop it, but it seemed like a good title. I am a junior systems analyst and I monitor Cisco routers and switches. On one of my routers, a Cisco 7200 series running IOS 12.2(15)T17, I have been monitoring a Denial of Service attack for … | |
im trying to create a simple LAN Chat Program (as projectwork for school)....usage of filehandling is a must in all projects...since all the school computers are connected by LAN...i am creating one FILE and trying to input and read that file and display it on the screen to make it … | |
With this piece of code when i call read i get the output [ICODE]Start of loop Archived filename = ./Data/Test.log End of loop Start of loop Archived File = DATA MANAGER End of loop[/ICODE] Edit: It is exactly what i want except it adds there odd characters at the end … | |
Hi guys. I will explain the problem I have in my own words. I have to make a program using the Fibonacci numbers, in which the user inputs a number of days and the original size a green crud population, and every 5 days the population changes by fibonacci numbers. … | |
I am a new user and I am looking for some help with one of my problem. I have to write a program that reads in from a file through structs and store the information in a single struct and write the code to display a single class. This needs … | |
Hi. I'm new here and would appreciate any help you can give me. I am a college student and I'm supposed to do this assignment where I take data from one txt file and put it into another. This is step one of a larger project. I have some code … | |
Hello, my question is how can I read decimal from txt file? For Example expression "2.0 1.3 +" - postfix to calculate it. The one that I have right now work for integers but when it starts reading it chops of the decimal part. I can figure out what i … | |
hello everyone....i need some help,i am using c++ and vectors, and text files to create a library system and i have a problem.....i used a vector named v1 and i was trying to use an if else to assign a created vectors elements value to another value example like v[10] … | |
hi everyone, I am making a textpad(basic textfile creator) in c++(console). It can create text files and then load them. But the problem is that when we load a file it can only show the data but not edit it or write further data. How do I code such that … | |
hello,I would like to create a class for basic file operations-just reading and writing a line.There seems no error in my program but it doesn't output anything.I think there is a problem with the functions for reading and writing.Please help... [code=C++] #ifndef HANDLER_H_ #define HANDLER_H_ #include <iostream> #include <fstream> #include … | |
Hey, ive written a piece of code which reads from a file called test.txt. all it does is use strtok to seperate the data from the spaces because there are alot of them, and then print them out, this worked fine when i did a test for just 1 line, … | |
Hey all, i'm a freshmen in college who is taking Intro to Computer Science with C++ and i'm just a beginner when it comes to programming so i have a problem. This is our assignment: [B]You are to write a program which inputs a Celsius temperature from the user, converts … | |
I compiled this code in dev c++ and i got 0 warnings and 0 errors, so it was a clean compile and whenever i run the exe i get this error which says assembler.exe has encountered a problem and needs to close. And gives me the error report thingy for … | |
I am developing an application for a video store, can someone guide me on different fragments of it.I need some help here. Here is what i have come up so far: [code=cplusplus] #include <iostream.h>// #include <string.h> #include <fstream.h>//Library fro File I/O using std::string; class Video { private: //Data Members string … | |
I've made a program that generates a Character's details(Game details, like level, name, HP, etc, based on a few parameters). I've added another .cpp file to it [without a main() function], but when I try to compile the whole project in Dev-Cpp, it just shows an error. My code is: … | |
Hi, I've just started a course in C++ about 3 weeks ago. Unfortunately, I'm pretty lost at the moment with this problem and my teacher said I'm on my own now. (I'm guessing he doesn't want to answer my questions anymore because I ask too many, but I really don't … | |
Good evening everyone, Firstly, I just want to say this is not homework related. I graduated 15 years ago, but I dabble with C++ purely for a hobby these days but must be getting rusty in some areas. I have a question with regard to string comparisons. What I have … | |
Hey, I'm having trouble with this piece of code. Basically, it's meant to look at a map file (which basically is a bunch of URLs paired to an ID) and then go through another file and replace each URL with it's corresponding ID. The code seems to work fine, but … | |
Hi friends, again i need ur help.. I hve a text datafile which consists of one word per line like this... program byte this example and i am using the following code to read the words from the datafile.. fstream f1; f1.open("file.txt",ios::in|ios::out); f1.getline(variable,10,'\n'); f1.close(); The datafile consists of more than … | |
Hello everyone...i need help with text file in c++,i know that we can append like ios::app and into a text file.....i need help in inserting a particular string to a particular line in a text file.....is that possible....So far i only knw tht it will append at the bottom of … | |
I have a problem with the new program, it compiles and and it debugs, but when I get to the command lines and enter my function it gives me a debug assertion failure. We are supposed to be finding the sum of the area of rectangles used for close approximation. … | |
HElp.. Friday 09.19 I must present a little program for my C++ university test. I remain just a little bug. I use this code to write my file .DAT [code=C++] ofstream fileScritturaPartita(nomeFile,ios::binary | ios::out | ios::app); fileScritturaPartita.write(reinterpret_cast < const char * >(&sfidaDaSalvare),sizeof(Partita)); [/code] It works very well but in the … | |
Hello, dear all. My algorithm as follows. my input is in Code2D.h file. actually i have to put in file 'Code2D.in'. but i dont know have to create it. By the way, my algorithm have no problem with N <= 4. but when i change N = 5, 6 , … | |
I am pretty new to programming. I am writing a fairly small and simple trivia program. It will be my 5th program to date. My biggest problem is how to add a list of Q/A. The program has 2 functions that handle the trivia part of the game. The 1st … | |
Hi all. I've written a bit of code to open a file and read from it. The simple version works: [code=cplusplus] ifstream conFile("code/constants.h", ios::in); while (getline(conFile, line)) { //etc. Process file.......... [/code] However, I really want the program to look for the file constants.h in the current directory and if … | |
I need to do something like this: [code] ifstream infile(Filename.c_str()); //ifstream infile(Filename.c_str(), ios::binary); string line; ///////////// Read Header //////////// //read magic number getline(infine, line); while(line[0] == "#") getline(infile, line); MagicNumber_ = line; //more ascii stuff ...... //start reading binary data int m; infile.read(reinterpret_cast < char * > (&m), sizeof(m)); [/code] … | |
The problem: Will not compile, i get the following errors: "invalid conversion from char to char*" "invalid conversion from char to const char*" Program Description: Opens a file and read each character into a linked list [code] #include <iostream> #include <fstream> using namespace std; const int MAX = 30; struct … | |
Hey, Im having some trouble with linked lists, I have been givin a task where I am asked to crreate a linked list which reads in a random set of chars from a .txt file and stores them in a linked list, then prints them out in a seperate function. … | |
I'm just writing a reading for the time a binary file where I stored records of my objects. It seems woorks very well. Now I'm working for random access at position "X": [code] ifstream myFile(fileName,ios::in); myFile.seekg( (X*sizeof( object )) , ios::beg); [/code] Should be ok. Before I start to write … | |
Hi All, I am having problems with reading input from a sequetail file and I can't figure out what is wrong. Can someone please help me out, I don't know if I am even doing it right, very new at this. The code below is how I generated my .txt … | |
I'm almost done with my assignment but now I'm stuck with some binary file problems. Below is the binary file section of my work. [CODE=cpp]cin.ignore(); cout << "\nPlease enter filename: "; cin >> openBinary; ifstream finBinary; finBinary.open(openBinary, ios::in | ios::binary); if (!finBinary.good()) cerr << "File could not be opened" << … | |
this is the program: [code=cplusplus] #include <iostream> using namespace std; int main() { double f0, speed, f1; f0 = 2e-10; speed = 75; f1 = ((speed + 6.685e8) * f0) / (6.685e8 - speed); cout << "The return frequency corresponding to 75 miles per hour is " << f1 << … | |
hey, This might be naive, but how come this bit of code isn't working??? [CODE] int lc=0; read.open(filename_user.c_str(), ios::in); while(getline(read, linecount, '\n')) { ++lc; }[/CODE] Have looked through the internet, and this code seems to be fine, so what is it that makes it not work?? the output is always … | |
I have a class that has functions which use <stdio.h> and <stdarg.h> to take in indefinite arguments, and one of the member functions taking in filenames. There's another function (call it the "do" function) where I want to read from ifstreams created from those indefinite number of filenames. I can … | |
I have been trying to follow what you guys where doing here because I have to do something simalar. Can you tell me what the name of your file is jaffo, is it a .dat or a .txt file? You where using ary, is that the file name? Acient Dragon, … | |
I'm having a little bit of trouble using the ifstream 'get' command. When I say trouble I mean it is not returning the values expected and I need a little guidance, if you will :). Basically what I'm doing is reading a file in through C++ and then going to … | |
Hello, Now, this may sound stupid, as it concerns basic file I/O, but my code doesn't work correctly- at least it isn't doing what I want it to. I wanted it to write a file the first time it runs, which it does perfectly, and every time it is run … | |
In my comsc class we are writing a program to determine when easter sunday is, my program works like a charm when i put each equation in a seperate function but when i try and take them out (as per teachers instructions) it craps the bed and gives me an … | |
[URL="http://searchsecurity.techtarget.com.au/articles/26194-Black-Hat-roundup-Vista-security-defeated-IOS-rootkit-DNS-flaw-worse-than-thought-#Vista"]Vista security rendered 'uselsess'[/URL] By Dennis Fisher [quote]Two security researchers have developed a new technique that essentially bypasses all of the memory protection safeguards in the Windows Vista operating system, an advance that many in the security community say will have far-reaching implications not only for Microsoft, but also on … | |
I have a litle problem when i try to list Aluno = Student (option 4 in the program). i have other problem, when i try to save some Aluno(student using option 1) te program telll me that it is already created. Some one can help me? [ICODE] #include <iostream> #include … | |
Please compare the two codes below why is the first one displaying output to monitor where as the second code is displaying some unwanted characters. CODE 1 ..... #include <fstream.h> #include <string.h> void main() { fstream File("test_file.txt",ios::out | ios::in | ios::binary ); char arr[13]; strcpy(arr,"Hello World!"); //put Hello World! into … | |
#include<fstream.h> #include<iostream.h> #include<string.h> using namespace std; class emp { public: char *per; int i; int write2() { ofstream out("ss.txt",ios::app | ios::binary ); cout<<"Enter some character ....\n"; per = new char[100]; cin.getline(per,100,'\n') out.write("\n",1); out.write(per,strlen(per)); out<< "\n"; per = "asdfgh"; out.write(per,strlen(per)); out.write((char *)&i,5); out.write(per,strlen(per)); return 0; } int read_2() { char * … | |
I am having trouble reading in data from a file. The data file store the information of albums and its respective track info eg 1234 //this is id number Scarlets Walk //album name Tori Amos //artist 24 //price 2 //stock Pop //genre Track A //track name 10 30 //track length … |
The End.