I am working with a code which stores the information of customers in a file called customer_details.txt then asks the user to enter a name and then searches for the name in customer_details.txt, if the name is found, the entire details of the user is displayed on the output screen. here is what I have done: #include<iostream.h> #include<stdio.h> #include<conio.h> #include<stdlib.h> void main() { FILE *fp; char name[20],dob[12],add[50]; int acc_no,i=0,random=95867; double mob_no; fp=fopen("customer_details.txt","a+"); if(fp==NULL) { cout<<"Error opening file customer_details.txt !!"; exit(1); } cout<<"\n\nEnter name:"; cin>>name; cout<<"\n\nEnter Date of Birth:(Date Month and Year separated by `-' ex: 25-01-1994)\n:"; gets(dob); cout<<"\nEnter mobile number:"; …

Member Avatar
Member Avatar
+0 forum 8

Hi all! Whenever I am working with my code in my main.cpp file, I can call character-handling functions like * isdigit * isalpha * isspace * toupper without importing the `cctype` library. However, my C++ How to Program Book shows that the cctype library must be imported before the functions can be used. Why and how am I able to access these (working) functions without importing the cctype library in my main.cpp file?

Member Avatar
Member Avatar
+0 forum 7

Hi, As we know constructor doesn't have any return value so it is not good idea to perform exceptional handling inside constructor.SO i would like to know if i am opening a file inside constructor and due to some reason (file not exist) failure happened inside constructor then how to tackle this issue. so below are some questionin my mind (1) should we perform exceptional handling inside constructor. (2) if failure (file opening falure) happens inside constructor, does it going to affect the object state. I mean to say object is going to be currupted. if yes then what are …

Member Avatar
Member Avatar
+0 forum 17

fstream file; file.open("PasswordGenFile.dat",ios::out); In writing into a .dat file what does the following line mean? file.write((char *) this, sizeof(PasswordGenerator)); And how can i convert this bit of code if i want to write it into a .txt file?

Member Avatar
Member Avatar
+0 forum 1

the problem I have here is: when I input an integer it works fine, but when i input any other thing, it doesn't give me a chance to input again when the loop iterates, it just keeps printing "error type the right thing" to the screen even though "cin var" is inside the loop. #include<iostream> #include<iomanip> using namespace std; int main(){ int var; while(true){ cout<<"please enter any integer"<<endl; cin>>var; if(cin.good()){ cin.ignore(10, '\n'); break; } cin.clear(); cout<<"error, enter the right thing"<<endl; } return 0;}

Member Avatar
Member Avatar
+0 forum 3

I have a text file and i want to replace a word from a specific location. For example want to replace 5th word from 12th line of file. How i can do that?

Member Avatar
Member Avatar
+0 forum 3

Following exceptions are `Checked Exception` or `Unchecked Exception` ArrayStoreException IllegalArgumentException

Member Avatar
Member Avatar
+0 forum 10

I am asking a question about file handling within python. I am capable of creating a text file which can then be read via python. However, i am trying to create a python Recipe storer and therefore i would need to be able to store recipes (entered through python) with details about ingredients and quantities under records which can be opened and viewed with python. For example: Two different recipes have been entered by the user, stored within a text document. The user only wants to open one of these recipes. How would the program be able to display the …

Member Avatar
Member Avatar
+0 forum 7

Hi All, i am here with a problem in file handling in java. i need to search all the files on system with extention *.fdr. which are not less den one day old. then i need to convert the selected file to csv which is perfomed by a command in dos(symanalyzer). then i need to attach the csv file to mail . can someone help me with the java code . i have done some R&D and found that i can use the method "lastModified()". Thanks and Regards Mukul

Member Avatar
Member Avatar
+0 forum 3

I have a text file transa.txt .I want the contents of the file to be filled in the array cell by cell.example the file reads: 1 1 1 1 0 0 1 0 1 1 1 1 so i want arr[0][0]=1,arr[0][1]=1,arr[0][2]=1...... Can someone please help me with this..I am stuck with this.

Member Avatar
Member Avatar
+0 forum 3

give me coding for search and edit a file in c++

Member Avatar
Member Avatar
+0 forum 8

I have attached one code of my project and i need a help in that. The code is running without any error but i am stuck up in modifying that how to make a statement, of invalid format of date or time if the user enters the wrong format should i use Try Catch blocks or simply use the if else statement I need to make it quite simple.

Member Avatar
Member Avatar
+0 forum 3

hi i have problem , i want to modify a file without copy to another file so any one can give how to do it ? I tried following method to modify a given location or pointer in file but did not work . ofstream outfile; outfile.open ("test.txt"); outfile.seekp (3,ios::beg); outfile<<5; outfile.seekp (12,ios::beg); outfile<<9;

Member Avatar
Member Avatar
+0 forum 7

Here is exercise in error handling, while looping and for looping with itertools.chain. It is also exercise of functions not letting user to go without giving proper input. I call them to myself 'jail functions'. Here you could add as an exercise breaking out of loop and continuing until user request to quit. The code works in both Python2 and Python3 with Python2 input overwritten to be raw_input.

Member Avatar
Member Avatar
+0 forum 1

Hi All, Could you please clear my doubt why this second catch block is called when exception is thrown only once. #include <iostream> using namespace std; class E { public: const char* error; E(const char* arg): error(arg) {} }; class B { public: B() {}; ~B(){cout<<"~B() called"<<endl;} }; class D: public B { public: D(); ~D() { cout<<"~D() called"<<endl; } }; D::D() try :B(){ throw E("Exception in D"); } catch(E&e) { cout<<"D()"<<e.error<<endl; }; int main() { try { D val; }catch(...) { cout<<"Last"<<endl;} }

Member Avatar
Member Avatar
+0 forum 1

I have been working on a conversion project for last few days where I need to convert a Java library to C#. At one point I came to java's certain feature called [Exceptions Thrown by a Method](http://docs.oracle.com/javase/tutorial/essential/exceptions/declaring.html). Here is a little glimpse of it: public boolean isRequest() throws NullPointerException { // blocks of code implementing isRequest() method; } For the C# implementation of this code snippet, I searched the web and quite shockingly found that, **C# does not support throwing exceptions in the compile time**. Now my question is, how can I implement this code portion in a C# library?

Member Avatar
Member Avatar
+0 forum 7

Telling you before hand, i am just starting to learn, so please refrain from making fun of me i k i am real weak in this. ok here is what i need to do, i have been trying for ages but i am having huge problem creating dynamic checkboxes. This is what needs to be done. When user clicks in the textbox, “Write a Quick Note” text should go away. > 3. When user writes something and presses ENTER key, it should add the text user just > entered in the checklist below that textbox. For example I write “Prayer” …

Member Avatar
Member Avatar
+0 forum 10

Program to Find the words starting with a or A from the source code itself and then modify it by removing the words from the source code and put it in another file. The following code doesn't work. Pls Help!!! #include<iostream.h> #include<conio.h> #include<fstream.h> #include<string.h> void Write(fstream &a, char b[]) { int i; for(i=0;b[i]!='\0';i++) { a.put(b[i]); //Created a duplicate file of the source code } } void main() { clrscr(); char *str,ch; fstream o,i; o.open("FILE.CPP",ios::in); // adate sddf o.seekg(0); cout<<" Altavista App "; //some words starting with A i.open("DUP.dat",ios::out); while(!o.eof()) { o.get(ch); i.put(ch); }; // asprine ddjgdssd sdag sas aadfd i.seekg(0); …

Member Avatar
Member Avatar
+0 forum 1

Hi, Can anybody help me out to solve string handling without using predefined spilt function , here come the questions for eg i have a input string as "hai welcome to the sample " so i should display as follows hai welcome to the sample pls advice, thanks for your time.

Member Avatar
Member Avatar
+0 forum 2

consider the following program #include<iostream.h> #include<fstream.h> void main() { int no; ifstream fin; ofstream fout; fout.open("create,dat",ios::app); fout<<"What is your fav. number"; fin>>no; fout<<no; fout.close(); } NOW HERE IS THE PROBLEM WHILE THE PROGRAM IS RUNNING PERFECTLY AND THE NUMBER IS BEING STORED IN A .DAT FILE BUT THE NUMBER IS NOT GETTING DISPLAYED IN THE NORMAL OUTPUT MODE (WHICH COMES UP WHEN YOU COMPILE AND RUN A PROGRAM,CTR+F9) Also i dont want to write cout followed by fout because that will double the number of lines nd make my program redundant though i know that it will work but still …

Member Avatar
Member Avatar
+0 forum 2

Hello, I have a problem when trying to prompt users on two levels with Perl. The first prompt command works fine. But when doing the second command as below, I get Enter a command (count/close/quit) : Enter a command (open/quit). I don't see right away why this happens. Any idea? Here is the beginning of my code: #!/usr/bin/perl # 1st command print 'Enter a command (open/quit) : '; ENTER_COMMAND: while ( defined( $command = <STDIN> ) ) { chomp $command; if ( $command eq 'quit' ) { last ENTER_COMMAND; } elsif ( $command eq 'open' ) { $name = ''; …

Member Avatar
Member Avatar
+0 forum 1

Greetings I have a USB RFID scanner. While I have this form1 up, I want to send any keyboard input and put it in a textbox which is in another form(say form2). I tried using this code but to no avail. The first form is named "MainMenu". Every time of a keypress, the the letter or digit input will go to another form. Is this even possible or am I just doing something wrong? Private Sub MainMenu_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress Form2.Textbox1.text = e.KeyChar End Sub

Member Avatar
Member Avatar
+0 forum 4

Well Guys! I was learning how to read and write class objects from & to file respectivily. And here is a small code that i made...... As far as the code goes its all well.... And i am getting what i want.... But what i want to know is, **where is the file that i am using saved??** Here the file is BLAHBLAH.dat. I cannot find it in any of the folders in the solution folder. And even a system full search didn't help. So where is it saved..... I use Microsoft Visual C++ 2010 Express Edition. Here is the …

Member Avatar
Member Avatar
+2 forum 7

Here is what I am trying to do: From VB.net open a word template --- Done Populate it from a database ------Done Have word report back with the saved file name so as I can add it to the database history ----Not done. I know is has something to do with the close events in word but I am unable to get it working. I have made a class which I think should work: Dim WithEvents wordApplication As New Microsoft.Office.Interop.Word.Application this gives me a drop down for Private Sub wordApplication_DocumentBeforePrint(ByVal Doc As Microsoft.Office.Interop.Word.Document, ByRef Cancel As Boolean) Handles wordApplication.DocumentBeforePrint but …

Member Avatar
Member Avatar
+0 forum 2

case 4: { cout<<"Enter the word you want to delete: "; gets(b); f1.open("anotherf.txt",ios::in); f2.open("tempf.txt",ios::out); while(!f1.eof()) { f1>>a; i++; if(strcmp(a,b)==0) { j=i; } } i=0; while(!f1.eof()) { if(i!=j) { f1>>a; f2<<a; } i++; } f1.close(); f2.close(); f2.open("tempf.txt",ios::in); f2.seekg(0); f1.open("anotherf.txt",ios::out); while(!f2.eof()) { f2>>a; f1<<a; } goto menu; } I am trying to delete a certain element from a file. However when i run it it only displays blank. And from testing it, i THINK it doesn't even reach the part of the code where the information is passed from the second file back to the first.Im new to file handling, please help! …

Member Avatar
Member Avatar
+0 forum 1

hi plz tell me the coding of exception handling in java..

Member Avatar
Member Avatar
+0 forum 5

Write a program (in a single .c file) with a queue of strings implemented using array. You should write ite a queue type. The program reads a set of strings stored in a file (filename given on command line as argument) and inserts each string in the queue. Then it removes each string and writes it to another file (also given as second argument on command line). filename: rollno_branch_batch_queuefile.c Note: for this particular assignment, you must use open(), read(), write() calls and use of fopen(), fread(), etc functions is not allowed. Hints: * This problem involves some thinking about combinging …

Member Avatar
Member Avatar
-1 forum 2

Hi all, I am creating one GUI application in java. I need to make menubar visible when particular panel is made invisible. Is it possible by creating an event which will be triggered when panel is made invisible? Can anybody help me? Thanks in advance!!!

Member Avatar
Member Avatar
+0 forum 3

Following is my code for reading from a file. #include<stdio.h> int main() { char s[10][10]; int i=0,j=0; FILE *ptr=fopen("input.txt","r"); char c; while(fscanf(ptr,"%c",&c)!=EOF) { if(c=='\n') { s[i][j]=0; i++; j=0; } else { s[i][j]=c; j++; } } s[i][j]=0; fclose(ptr); for(j=0;j<i;j++) printf("%s\n",s[j]); return 1; } and content of input.txt is A->XAZ|Yz|z X->xZ|x Z->Xz It is expected to get an output as in file. But I'm getting an output like this . A->XAZ|Yz|X->xZ|x X->xZ|x Z->Xz Can anyone explain me that why this happens.? `

Member Avatar
Member Avatar
+0 forum 3

I am having trouble figuring out how to handle events for components that are created when I click a button. I have a class called rows which is used to create a row of components (combo boxes) . I have a button on my form that has an event to create a new rows object. I would like to have events for the newly created combo boxes but I dont know how or where to put them. Here is my form code: private void button1_Click(object sender, EventArgs e) { rowClass row = new rowClass(startingBuildingComboBoxX, startingRoomComboBoxX, startingProblemsTextBoxX, startingNotesTextBoxX, startingY + 30); …

Member Avatar
Member Avatar
+0 forum 6

The End.