Saturday, May 9, 2009

Need help in C++ file concepts?

One file is having:


name= xx


age=yy


location=zzz





if i give input as name it should print xx


if i give input as age it should print yy and so on..





like the above if i give any key words(name, age,...) it should give the corresponding initialized value from the given file..





i want C++ program for obtaining the above. I'm not familiar with C++ file concepts..so pls provide program for the above


thank you

Need help in C++ file concepts?
First create a file "check.txt" which contains the operands and their corresponding codes(seperated by a tab...)...


(eg)


name xx


age yy


location zzz





save the file in your "bin" folder which is in your c++ software location... then run this code below...





if you have any doubts regarding data structures, oops concepts, assembler coding, microprocessor programming, microcontroller programming, java programming, mail me...


jeganshunmugavel@yahoo.com














code:








#include%26lt;stdio.h%26gt;


#include%26lt;string.h%26gt;


#include%26lt;conio.h%26gt;








void search(char temp[])


{


FILE *check;


char ope[10],code[10];


strcpy(code,"");


check=fopen("check.txt","r");


fscanf(check,"%s\t%s",ope,code); //code[strlen(code)-2]='\0';


for(;strcmp(ope,"NULL");)


{


if(strcmp(ope,temp)==0)


{


fclose(check); printf("%s\n",code);


return;


}


fscanf(check,"%s\t%s",ope,code);


}


fclose(check);


printf("\nNOT FOUND");


return;


}





int main()


{


char temp[10],another='y';


while(another=='y')


{


printf("\nEnter your operand: ");


scanf("%s",temp);


search(temp);


printf("\nAnother?");


another=getch(); fflush(stdin);


}


return 0;


}
Reply:u want someone to write program for you :-)





write it urself and if have any error then ask for resolution of error.


or send me the prog i'll solve it for u.





U can get many such sample programs in any c++ book.


C++ file streams?

I'm kind of stumped on this one. I want to read in a .txt file with C++'s ifstream object and save it to a string object.





The problem is: I'm having trouble saving the entire contents of the file to a single string, so I can manipulate it.





How can I do that ? %26gt;.%26lt;

C++ file streams?
I would use an array of strings. First read the whole file and enumerate the number of lines involved lets call this n, use a while loop for doing this:


while(file.readline())


{


n++;


};


Create string array:


String[] arr = new String[n];


fill in the lines for each line in the file:


int m = 0;


while(file.readline())


{


arr[m] = file.readline().toString();


m++;


}





Then you can manipulate the array of strings, and when you want you can append the strings using a simple for loop.


Also consider the StringBuilder Class it might be a more precise solution.
Reply:dont use any feedbacks like new line tabs etc

peony

Can any creditor file a 1099-C for an unpaid debt?

I provide outpatient anesthesia services for a plastic surgery center.





About four years ago, I filed an insurance claim for two patients for anesthesia services. Rather than send the payments to me, the insurance company sent the payments to the patients. The patients, however, did not pay me. The patients were sent to collections... that was fruitless. Now I'm ready to give-up collecting this debt. Can I file a 1099-C?





The IRS instructions specifically indicate the 1099-C is those whose primary business is lending money. However, while searching the internet I have come across examples of 1099-C filed for debts at a music store for an unpaid guitar or a jewerly store for unpaid gems.





Is the 1099-C only for those organizations whose lending of money is a significant part of their trade or business?

Can any creditor file a 1099-C for an unpaid debt?
If you are willing to completely forgive the debt and not use any more collection efforts, you can file a 1099-C and you can deduct the debt from your taxable income provided you included the debt in your taxable income when the services were performed. If you are on a cash basis of accounting and do not account for the income until paid, you cannot deduct the debt from taxable income in the current year because it was not reported as income when earned.


Help in C++ File Handling?

Write a program which can read, write, delete and update an object from the file using C++.


Sample out put of the program:





1) Enter New Record.


2) Update Record


3) Delete Record


4) Search Record





Enter Your Choice! 1








Enter Student Name: xxx


Enter Student ID : xxxx





NOTE: These informations about the Student Object should be stored in the text file.





Out Put of the Sample Program:





Student Name : xxxx


Student ID : xxxx








At the end I request also try to illustrate the deletion and updation process in words if you can do this for the student which is in search of some informations about file handling in C++

Help in C++ File Handling?
That is going to be quite difficult. If you are still stuck with your project assignment may be you can contact a programming expert live at website like http://askexpert.info/ .
Reply:Open up your compiler documentation or on-line help file and look up fstream. There will probably be sample code showing you how to open, read, write, and close a file.





If your manual doesn't have it, Google: fstream example code


to find snippets of example code.
Reply:Dude.... you no offensive but you need to do your own project to learn how to do it...


C++ file for reading?

I have a C++ file,a file for reading only.How can I show on the screen what the file contains?

C++ file for reading?
Right-click on the file, open it using notepad.


How to include c or c++ file in borland c++ builder 6.0?

I want to include user defined header file in my c program. How to include the c or c++ header file in my c or c++ program in borland c++ builder 6.0.

How to include c or c++ file in borland c++ builder 6.0?
u will have header folder from there u can
Reply:i'm guessing you already have your header files and your main cpp.





create a new project.


save


add both files to the project.


compile%26amp;run
Reply:in the INCLUDE FOLDER where other headers are put your user defined header





# include "userdefined.h"

long stem roses

C# file to .wsdl file?

I want to automatically generate a .wsdl file from a web service i've created using C# (in visual studio).


I know how to create a C# file from a .wsdl file but i want to do it the other way around. is this possible? if so, how?

C# file to .wsdl file?
Browse (with IE) your web service home page (the asmx page). Then type the following after the URL:





?WSDL





Then press enter. It will give you the WSDL.
Reply:The answer is wrong,she asked help to create WSDL from a c# class. But the help u have given is to create proxy class.No tool available for this.Using reflection u can do this.Use the assembly class and ServiceDescriptionReflector,se... in google Report It



What is the C File Function to delete a letter say, 'A' in a File. Anything like fgetc, fputc etc?

I have developed a program for Bitstuffing. It scans for characters from a file, and if it encounters five 1's continuously, it will append a '0' after it and write to a new file. This concept is called Bit Stuffing. Now, I need to know how to remove that '0' in the file I wrote.


==##CODE ##==


FILE *fp1,*fp2; //Couple of File pointers


int i=0; //Counter


char c; //variable to get char from File


fp1=fopen("bit.txt","r"); //Open file in Read mode


fp2=fopen("b1.txt","w");//Open file in Write mode


while(!feof(fp1))


{


c=fgetc(fp1); //scan char by char till EOF


if(c=='1') i+=1;


else if(c=='0') i=0;


fputc(c,fp2);


if(i==5)


{


fputc('0',fp2); //append 0 after five 1s and reset i


i=0;


}


fclose(fp1);


fclose(fp2);


==## END OF CODE ##==


bit.txt content: 111111


b1.txt content: 1111101





How to remove that 0?





Help would be much appreciaited.

What is the C File Function to delete a letter say, 'A' in a File. Anything like fgetc, fputc etc?
Try this method:


1) Read b1.txt


2) Check for five 1's write the contents of b1.txt into a new file temp.txt


3) Once you have written it . delete b1.txt


4) rename temp.txt as b1.txt





Program


fp3=fopen("temp.txt","w");


rewind(fp2);


i=0;


while(!feof(fp2))


{


if (i%26lt;=5)


{


c=fgetc(fp2);


fputc(c,fp3);


if (c==1)


i++;


if(i==5)


i=0;


}


}


fclose(fp2);


fclose(fp3);


remove("b1.txt");


rename("temp.txt","b1.txt");
Reply:you are most welcome...why dont you send that program to my mail. Its ibndawood@gmail.com. Thanks in advance Happy Programming! Report It

Reply:Or else you may contact a C expert. Check websites like http://getafreelnacer.com/


C# Save to file?

A copy of the C# (.c) file I am working w/ is located at the URL below (view or download). Did this cause code is hard to view on this site.


www.kylenickl.com/help.c





Basically I need to save the loaded Crystal Report 'Acknowledgement.pdf' file to 'c:\Report.pdf'. The code above is a C# form that has a Crystal Report Viewer in it (thats why the report is already loaded). I want the report to save when I click the button which should save the file to the location mentioned above (I'm stuck here), email the file (code working), then delete the file (code working). Thanks

C# Save to file?
I don't think anyone understands your question