answersLogoWhite

0

What else can I help you with?

Continue Learning about Engineering

What is a file pointer?

A file pointer is an opaque object that refers to a file. Opaque means that you should not attempt to delve into its specific value, other than to use it as a file pointer. FILE *fp; /* fp is the file pointer */ fp = fopen("somefile.txt"); if (fp == NULL) ...{exception}... fprintf(fp, "Hello somefile.txt"); fclose(fp);


Write a C program that reads the contents of a text file and print the contents to the screen line by line preceded by line number?

#include<stdio.h> #include<conio.h> void main(void) { FILE *fp; char ch; int count=0; clrscr(); fp=fopen("seo.c","r"); while((ch=fgetc(fp))!=EOF) { if(ch=='\n') { count++; printf("%d\n",count); } else printf("%c",ch);} fclose(fp); getch(); }


Write a c program with an append operation on an existing file?

#include<stdio.h> #include<stdlib.h> int main() { FILE *fp; char a[60],b[60]; printf("Enter the name of the file\n"); scanf("%s",a); fp=fopen(a,"a+"); printf("Enter a single line to append to the file %s :\n",a); scanf(" %[^\n]s",b); fprintf(fp,"%s",b); printf("Append Successfully to the file %s",a); fclose(fp); return 0; }


C program to remove all comments from a c program?

/ sub.c Copyright 2009 vishnuprathish This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. / #include int main(int argc, char** argv) { FILE *fp; fp=fopen("sub.c","r"); char ch; ch=getc(fp); while(ch!=EOF) { if(ch=='/') { ch=getc(fp); if(ch=='/') { while((ch=getc(fp))!='\n') { getc(fp);//This commment wil be removed } } if(ch=='*')/*This also wil be removed*/ { while(1) { ch=getc(fp); if(ch=='*') { ch=getc(fp); if(ch='/') { break; } } } } } printf("%c",ch); ch=getc(fp); } return 0; }


Write a program to store students records in a file?

#include#includeFILE *fp;sturct student{int a,r;char n[10];float p;}s;main(){int response;clrscr();fp=fopen("file1.dat","w+");while(1){printf("\nInput data from keyboard to write to file\n");printf("input name ");scanf("%s",s.n);printf("\nInput roll no.,age and percentage ");scanf("%d%d%f",&s.r,&s.a,&s.p);fprintf(fp,"%s%d%d%f",s.n,s.r,s.a,s.p);printf("\nAnother record 1:yes, 0:no ");scanf("%d",&response);if(response==0)break;}rewind(fp);printf("\nDate storeed in file is\n");printf("\nName\tRollNo.Age\tPer.\n");while(!feof(fp)){scanf(fp,"%s%d%d%f",s.n,&s.r,&s.a,&s.p);printf("\n%s\t%d\t%d\t%f",s.n,s.r,s.a,s.p);}fclose(fp);}

Related Questions

What does fp mean on facebook?

Fp mean "FanPage" !! :0


What does LP mean on harvest moon ds cute?

LP are love points, and FP are friend points. you get LP and FP for someone with a heart by them. Anyone else would just be FP.


What does fp mean?

Fire Place Fire Place


What does FP certificate mean after a doctors name?

It means family practitioner.


What does FP mean for reason on court calendar?

According to the Key to Calendar Event Codes listed on the San Luis Obispo Superior Court web site, FP translates to "FURTHER PRE-TRIAL"


What does "FP" mean in music and how is it used in musical notation?

"FP" in music stands for "forte piano," which means to play a passage loudly (forte) and then immediately softly (piano). In musical notation, it is indicated by the letters "FP" placed above the notes where the dynamic change is required.


When did FP Jac die?

FP Jac died in 2008.


When was FP Jac born?

FP Jac was born in 1955.


What does fp stand for in Harvest Moon DS?

FP stands for Friendship points. Tell FP by buying a Love Bangle from Roller.


What is a file pointer?

A file pointer is an opaque object that refers to a file. Opaque means that you should not attempt to delve into its specific value, other than to use it as a file pointer. FILE *fp; /* fp is the file pointer */ fp = fopen("somefile.txt"); if (fp == NULL) ...{exception}... fprintf(fp, "Hello somefile.txt"); fclose(fp);


What does fp mean on bank statement?

FPI = Fast Payment Initiative , Basically its a form of instant money transfers between bank accounts


When was Shawlands FP RFC created?

Shawlands FP RFC was created in 1906.