2,025 Topics

Member Avatar for
Member Avatar for Rikard

Hallo! I've been having some trouble getting a save/load function to work properly. I'm trying to save object and their properties to a file in binary using fstream. And then being able to load the object from the binary file the next time im running my project. Quick breakdown: I …

Member Avatar for Rikard
0
214
Member Avatar for ragoo

Hiya, I dont know if I am in the correct forum i.e. Networking. I am having problems with Server / Client communication. I send data over to the client and it records and prints out in cout, but what I want to do is print in a file. I used …

Member Avatar for Ancient Dragon
0
70
Member Avatar for neoraghav

Hi, I want to create a log file that captures all the actions happening...anyway i got code for that from internet. Now what i want to do is, make that [COLOR="Red"][U][B]file read only[/B][/U][/COLOR] so that the data is not modified by external application or user. [code=c++]log(char* msg) { time_t now …

Member Avatar for neoraghav
0
2K
Member Avatar for pawan_sharma777

i make this project what i unable to use file handling[CODE] #include<iostream.h> #include<conio.h> #include<dos.h> #include<stdlib.h> #include<stdio.h> #include<string.h> #include<fstream.h> #include<ctype.h> #include<bios.h> #include<ctype.h> int menu(int,char a[25],char b[25],char c[25],char d[25],char e[25],char sl1[2],char sl2[2],char title[40],char under[2]); void lbyl(char a[50]); void main_menu(); void student_menu(); void mark_menu(); int records=0; void lbyl(char a[50]) { int l,i; l=strlen(a); …

Member Avatar for nbaztec
0
155
Member Avatar for onako

My file needs to be updated frequently, meaning that new data has to be appended, but in a very specific way. The following is the sample content of my "file.txt" (2 vectors of length 6): [code] 1 2 3 4 5 6 7 8 3 4 5 6 [/code] After …

Member Avatar for onako
0
277
Member Avatar for Jsplinter

I have data stored in a deque that I wish to write to disk using fstream. So far this is the test code I have written. [code] int j = 10000; deque<double> m_data; for(int i = 0; i < j; i++) { m_data.push_back(i); } std::fstream myfile; myfile.open ("data2.bin", std::ios::out | …

Member Avatar for Jsplinter
0
2K
Member Avatar for Vllinator

Hi im writing a function in a program that lets the user delete a specific record in a file, the user is also able to recover this record. The easiest way i found is when the record is deleted, the record will be set to deleted using bool. Then in …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Borkoff

Hi everybody! I must make program in c++ that reads unknown number of words from a text file to char arr which after that i will have to sort the words by the first letter by alphabet in a stack. can any body help me please? txt file: den rock …

Member Avatar for Borkoff
0
151
Member Avatar for saloth

Hi, i'm making a simple texteditor from VB6, and i use Visual C++ as my back end. i call a function where in I will read another text file and put it in a structure. this is the function: void loadR() { ifstream file; file.open("C:/CaseStudy/CaseStudy/Rsrvd.txt",ios::in); for (i=0; i<44; i++) { …

Member Avatar for ftl25
0
194
Member Avatar for ravi_shekhar06

[code]#include <stdlib.h> // include <stdlib.h> rather than <cstdlib> for mkstemp #include <fstream> #include <vector> #include <algorithm> #include <ios> #include <ostream> #include <cstring> #include <sys/stat.h> #include <sys/types.h> #include <signal.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <netdb.h> #include <netinet/in.h> #include <errno.h> #include <pthread.h> #include "socket_server.h" #include <c++-gtk-utils/shared_handle.h> #include <c++-gtk-utils/callback.h> #ifdef HAVE_STREAM_IMBUE …

Member Avatar for Fbody
-1
174
Member Avatar for chromos

amateur programmer here looking for some pretty basic help from the community. I am completing a program which is supposed to calculate the total monthly/annual cost for a vehicle; mind you, it's meant to be simple, but I probably shoot myself without noticing... [CODE] #include <iostream> using std::cout; using std::cin; …

Member Avatar for gerard4143
0
89
Member Avatar for GooeyG

A company has four sales people (1 to 4) who sell five different products(1 to 5). Once a day, each salesperson passes a slip for each different type of product sold. Each slip contains the following: a)the salesperson number b)product number c)total dollar value of that product sold that day …

0
85
Member Avatar for applepomme

I used this to write the matrix into a file: int Nx, Ny, Nz; Array <complex<float>, 3> matrix(Nx, Ny, Nz, ColumnMajorArray<3>()); ...get matrix data... fstream outbin(outname.c_str(),ios::out|ios::binary); outbin.write(reinterpret_cast<char *>(matrix.data()),sizeof(complex<float>)*Nx*Ny*Nz); outbin.close(); Then, I used this to read this matrix, works fine, values and orders are correct too: Array <complex<float>, 3> matrixb(Nx, Ny, …

0
85
Member Avatar for praky

i am writing a program on huffman's code in C++. I have wriiten the program till building the huffman tree. now I have to generate the code by traversing the huffman tree. I have no idea how to do that logically. please help with code or algorithm. Here is my …

Member Avatar for praky
0
4K
Member Avatar for Gekitatsu

In short, I've created a program that when a user left clicks it will create a dot at that location (cursor position). After doing some debugging (reviewing coords printed) it doesn't appear to be a coord problem (not sure though), but a perspective problem (may be displaying improperly). The problem …

Member Avatar for Gekitatsu
0
140
Member Avatar for MAbebe

Can any one please help me figure out what I am doing wrong on the following C++ programing language? I couldn't figure out what I am doing wronge that it gave me a hard time to compile it. Here is what I have done so far. using namespace std; struct …

Member Avatar for chococrack
0
165
Member Avatar for Jixz

To make a long story short here is the situation I'm in right now: I have one thread downloading a file from the web to a local file. I need the other thread to get the local file's current size AS its downloading. So, what would you guys recommend to …

Member Avatar for Ancient Dragon
0
152
Member Avatar for bmos31

I'm writing a code that takes a 5-bit binary string from a file 'message.txt', converts it to integers. The encoded letters are assigned numbers starting with a=1, b=2, etc. So if the original letter is 'a' and the key(fixed number of spaces) is 2, the encoded letter is 'c' which …

Member Avatar for bmos31
0
493
Member Avatar for Ryujin89

My instructor wants us to create a program that relates to some event we have recently gone through and I need help to get the rest of the code to work. Scenario I passed by the instructor is : I just got a car which my grandfather paid in advance …

Member Avatar for James cuck
0
8K
Member Avatar for therstonsplace

so im writing some video/image editing software and im stumped... not about the code so much cuz what im doing works fine .. im not convinced it is the most efficient use of my computer but it works. first my code... [CODE] #include <iostream> #include <fstream> using namespace std; int …

Member Avatar for NicAx64
0
106
Member Avatar for dineshcbe

[COLOR="Red"]When i am writing a content into a file as a binary, it's quite stored in a binary format but, my problem is during the reading.After the reading i am receiving the content two times. Actually i don't know whether it writes or reads two times. Here is the code.[/COLOR] …

Member Avatar for Momerath
0
93
Member Avatar for dineshcbe

[COLOR="Red"]I have a problem when i am writing a content into a files as a binary format.I noticed, that it writes the content two times into the file. Here is the code.[/COLOR] [CODE] #include<iostream> #include<string> #include<fstream> using namespace std; class store { protected: char pass[50]; public: fstream file; store(); ~store(); …

Member Avatar for Narue
0
131
Member Avatar for caribedude

Hi, I'm having some problems with this bit of code. I need to randomly open some files that have numbers as their filenames. i came up with this snippet to be able to open them from numbers 0 to 99. The code should randomly pick a number and try to …

Member Avatar for caribedude
0
283
Member Avatar for EricMack

[ATTACH=right]17013[/ATTACH]It's official - Apple says it will be [URL="http://www.sfgate.com/cgi-bin/article.cgi?f=/n/a/2010/09/01/financial/f100538D23.DTL"]offering individual TV episodes for download 'rental.'[/URL] While many are already heralding the announcement from yet another much-hyped media event in California as another nail in the coffin of old school television, Daniweb spoke to [URL="http://www.danrayburn.com/"]Dan Rayburn[/URL], a principal analyst at Frost …

0
425
Member Avatar for srivardhanms

[code] #include <iostream> #include <fstream> #include <string.h> #include <ctype.h> const int SIZE=100; using namespace std; class Person { private: char name[30],address[50],phone[11]; public: friend ostream &operator << (ostream &os, Person &p); friend istream &operator >> (istream &is, Person &p); friend ofstream &operator << (ofstream &fos, Person &p); friend ifstream &operator >>(ifstream …

Member Avatar for mike_2000_17
0
2K
Member Avatar for ganesh_IT

Hi guys, i am doing one accounting project. I use 3 binary files to store account holders information, login information and transaction. For mini-statement i need to read my Transaction binary file in backward. i dont know how to do ... My structure is [CODE] struct Transaction_Info { int AccountNumber; …

Member Avatar for Ancient Dragon
0
165
Member Avatar for therstonsplace

im trying to open a .mov file in binary which is easy enough to do... i haven't coded in a while... but i reread the book i had in school on the chapter on fstream.... i am instantiating an fstream obj with ios::binary to open a .mov file... i can …

Member Avatar for therstonsplace
0
86
Member Avatar for dorien

Hi, I have been reading a number of posts about this, but I have not been able to figure it out. I want to write hex to a midi file. The hex code of the midi file looks like this: [CODE]4D 54 68 64 00 00 00 06 00 01 …

Member Avatar for dorien
0
9K
Member Avatar for GuyClapperton

[URL="http://www.dell.com"]Dell[/URL] is going to launch its latest assault on the hand-held device market with the release of a handset called Aero. It's going to be available in the US only but that's a big enough market; it will cost $99 on contract. It's a move that will surprise many, for …

Member Avatar for extremeb
0
241
Member Avatar for gilmarP

Hi, Can anybody give me a hint on how to add a counter inside the logfile? For example, if at first, the log file was created, it will write the current counter number, let say Log1. Everytime the application is open/launch the loop start and writes Log1, Log2, Log3, Log4 …

Member Avatar for NicAx64
0
222
Member Avatar for laughnan

I send out multiple types of variables (i.e. 2 char arrays, 1 int, 1 double, and two more char arrays). But when I read then back at the beginning of the program (building a LLL) I get multiple declarations of the same variables and then when I display the LLL …

Member Avatar for Kanoisa
0
4K
Member Avatar for VilePlecenta

[CODE]HMODULE g_hModule = GetModuleHandle( 0 ); HRSRC hRes = FindResource( g_hModule, MAKEINTRESOURCE( ID_DLL_MYDLL ), "ID_DLL" ); HGLOBAL hResource = LoadResource( g_hModule, hRes ); DWORD iResSize = SizeofResource( g_hModule, hRes ); BYTE* pData = ( BYTE* )LockResource( hResource );[/CODE] When I included a dll file into my project, I used: [CODE]fstream …

Member Avatar for mike_2000_17
0
344
Member Avatar for umesh314

// program implement the working of files simple stock // management #include <iostream.h> #include <fstream.h> #include <iomanip.h> #include <stdlib.h> #include <stdio.h> class stock{ int code; char name[30]; float cost; char flag; public: void getStock(); void putStock(); char getFlag(); void putFlag(char); int getCode(); }; int stock :: getCode(){ return code; } …

Member Avatar for Ancient Dragon
0
134
Member Avatar for King_Alucard

I have finished editing the program but I still have a couple of errors that I can't figure out, please help Errors: Error 1 error C2601: 'split' : local function definitions are illegal \\ilabss\home$\D03279277\Documents\Visual Studio 2005\Projects\err\err\err.cpp 97 Error 2 fatal error C1075: end of file found before the left brace …

Member Avatar for Ancient Dragon
0
268
Member Avatar for Glass_Joe

[ATTACH=RIGHT]16788[/ATTACH]If you’re a petty thief, an iPhone must look like a mobile Mona Lisa. Their sleek design, variety of features, portability, coveted ownership, and lofty price make for an appealing and readily available target. But scum of the earth pay heed: Apple filed for a patent yesterday (August 19th) to …

Member Avatar for Agni
0
1K
Member Avatar for Bigbrain99

Hi guys, actually i'm trying to write a program which will write the user input into dat file and start to count the user input from 1. When user inputs second value, it will go to other line and put 2 in front of user value. Any idea how to …

Member Avatar for mrnutty
0
113
Member Avatar for Bigbrain99

How to label the first input of user as 1 ,second input 2, third input 3..etc by using ofstream append? Everytime when I used terminal to run it e.g. ./addcontact.cpp name1 ./addcontact.cpp name2 so that inside dat file it will has number of sequence in front of new name? e.g. …

Member Avatar for Bigbrain99
0
109
Member Avatar for dflatt

i'm trying to use string stream to get data from an input file. the program works until it get's to adding the elements to the array. i'm still not completely sure how to make use of stringstream yet or if i'm using it right. [CODE] ifstream ipf; ipf.open(test.txt); char c; …

Member Avatar for dflatt
0
147
Member Avatar for indigo.8

Hey, I have an array of ints that are read from a file then stored in an unsigned char array. The array is declared in a static link. The pointer is then passed to main. Main then calls a DLL which will process the information that is stored in the …

Member Avatar for indigo.8
0
5K
Member Avatar for fire_

Hello. I have some problems. 1.With for cycle. This is my code: [CODE]#include <iostream> #include <fstream> int main () { int i; int i2; char sentence [200]; char repeat; ofstream file ("file.txt", ios::app); for (i=0; i<1;) { cout << "Enter sentence (max. 200 symbols)\n"; cin >> sentence; if (!file) { …

Member Avatar for Kanoisa
0
167
Member Avatar for Bigbrain99

[CODE]void addname(string name) { ofstream myfile(CONTACTS,ios::app ); myfile.open(CONTACTS); if (myfile.is_open()); { myfile<<i++<<name<<endl; myfile.close(); } }[/CODE] Initially the codes just kept on overwriting the existing file, but after that i was told to put ios::app. However, it is still now working....now even worse...ofstream is not even writing the file...hellp..

Member Avatar for Bigbrain99
0
117
Member Avatar for camcam08

i have an error on this code i cant open example.txt using my declarations. #include <fstream> #include <iostream> #include <string.h> #include <time.h> #include <string.h> using namespace std; int main() { char time[9]; char date[9]; _strtime(time); _strdate(date); string nop; nop = "example.txt"; ofstream dtfile(""nop"", ios::app); dtfile<<time; dtfile<<" "<<date<<endl; dtfile.close(); }

Member Avatar for mrnutty
0
79
Member Avatar for gallantlex

Firstly, Here's my code running in VS 2010 [CODE=c] #include <iostream> #include <fstream> #include <string> #include <list> using namespace std; class Student { friend ostream& operator<<(ostream&, Student); friend istream& operator>> (istream&, Student&); private: int stuId; string name; int gpa; public: Student(int, string, int); int getStudId(); }; ostream& operator<<(ostream& out, Student …

Member Avatar for gallantlex
0
967
Member Avatar for gallantlex

Firstly, Here's my code running in VS 2010. [code=c] #include <iostream> #include <fstream> #include <string> #include <list> using namespace std; class Student { friend ostream& operator<<(ostream&, Student); friend istream& operator>> (istream&, Student&); private: int stuId; string name; int gpa; public: Student(int, string, int); int getStudId(); }; ostream& operator<<(ostream& out, Student …

Member Avatar for gallantlex
0
184
Member Avatar for indr

the following is the code... #include<iostream> #include<iomanip> using namespace std; int main() { float start_temp,stop_temp; float step,F,C; cout<<"start temperature:"; cin>>start_temp; cout<<"stop temperature:"; cin>>stop_temp; cout<<"step temperature:"; cin>>step; float i=0; cout<<setw(10)<<"celsius"<<setw(15)<<"fahrenheit"<<endl; cout<<setw(25)<<"celsius"<<setw(15)<<"fahrenheit"<<endl; for(i=start_temp;i<=stop_temp;i=i+step) { C=(5.0/9.0)*(i-32); F=32+(9.0/5.0)*i; cout<<setprecision(2); cout.setf(ios::fixed); cout<<setw(10)<<C<<setw(10)<<i<<setw(10)<<F<<endl; } } and the output for the above code is: start temperature: 0 …

Member Avatar for Luther von Wulf
0
119
Member Avatar for CatRambo

[ATTACH=LEFT]16646[/ATTACH]Yesterday, Facebook released an [URL="http://github.com/facebook/facebook-ios-sdk"]updated SDK[/URL] for the [URL="http://www.daniweb.com/reviews/review291912.html"]Apple iOS4[/URL], intended for use with Apple's iPad, iPhone, and iPod Touch. Between this and the recently released Facebook SDK for Android, third-party developers can build applications with a social networking component for two of the most popular mobile platforms. Two key …

0
558
Member Avatar for sangoku

Hy i Know it is not on English but could somone take a look on my code and tell me what I am doing wrong.... [CODE] #include <iostream> #include <fstream> //ukljucujemo cstring biblioteku koja omogucava napredne operacije sa stringovima #include <cstring> using namespace std; #define VELICINA 40 //fixsno definisemo vlisicinu …

Member Avatar for sangoku
0
393
Member Avatar for Emily Banks

[ATTACH=right]16448[/ATTACH]In the fight to be the No. 1 smart phone, Google's Android stands to surpass the iPhone's top seat in two years, according to [URL="http://www.isuppli.com/Mobile-and-Wireless-Communications/News/Pages/Googles-Android-to-Outstrip-Apples-iOS-by-2012-iSuppli-Forecasts.aspx"]market researcher iSuppli Corp[/URL]. "Google and Apple are engaged in a fierce battle for control of the wireless market, which represents the most lucrative growth opportunity …

Member Avatar for virensanyaja
1
466
Member Avatar for PCBrown

[ATTACH=RIGHT]16606[/ATTACH]Apple released their latest firmware update for both the iPhone and iPad today, versions 4.0.2 and 3.2.2 respectively. Unfortunately for those who haven't jailbroken their device yet, this will prevent you from using the PDF based JailbreakMe tool in the future. In a similiar fashion, it will remove the jailbreak …

Member Avatar for Radovich
0
199
Member Avatar for helpme87

so i am designing some software to prompt the user to enter their account number which in turn leads them to have to input their usage of ln. this then is to be displayed in a database file. i have all the code done for this. it reads in the …

Member Avatar for helpme87
0
151

The End.