I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements
Expert: Prince M. Premnath Date: 3/24/2008 Subject: How to save asin Values in a file ?
Question Hi,
I have one question related to filehandling in c.
Q:How i can store the different values of a sine wave equation
y=a sin(wt)in a file in the form of matrix.
i would be greatful if u could help me out for finding a solution.
Thanks and Regards,
Smita
Answer Hai Dear Samita !
Perhaps its simple to store the values of a sine wave equation, just follow the simple steps .
1. Create simple structure with two members say x , and asin of type double.
eg
struct sinvals
{
double x;
double val;
}structvar;
2. Create a structure variable .
3. Read the value of x , and calculate the corresponding asin value of x using the built in function and store the result in the member val.
4. Now write the contents of the structure variable onto the output file
The code given above is self explanatory , say structvar is structure variable , fileptr refers the pointer to the output file ! the 3rd argument 1 refers number of records to be written on file !
For more queries and doubts feel to post a follow up !