read, fread, fgetc, fgets, fscanf etc... use the help/manual
import java.io.*; class Files { public static void main(String a[])throws IOException { int i,line=0,c=0,len; char k; boolean m; File f=new File("info.txt"); FileInputStream f1=new FileInputStream("info.txt"); len=f1.available(); for(i=0;i<=len;i++) { k=(char)f1.read(); c++; System.out.print(k); if(k='/n') { line++; System.out.println(+line); } } System.out.print("number of characters="+c); } }
why does a program consists of more than one object file in c++
edit your autorun.inf file, add the line open=C:\windows\explorer.exe good luck Kevin
program to extract a given word from a file
HIYou can first include the 1st program in ur 2nd program using # include and then whatever be the output from frst it can be used in second program.pankajThat's what popen is good for. Read the manual.
1. You (human) want to read an include file: use a text editor. 2. Your program wants to read a file: use open/fopen.
File Operations in C are accomplished by the use of pointers.Pointers are use to point to a particular memory location.File are read and written by using file pointers.The Keyword FILE is used to declare a file pointer.The Complete Program for writing text to a file and saving it and copying it to a new location is given at http://c-madeeasy.blogspot.com/2011/07/program-in-c-to-write-data-to-file-and.html
Yes. You can either create a file for both reading and writing, or you can re-open a file for reading after creating and writing to it.
import java.io.*; class Files { public static void main(String a[])throws IOException { int i,line=0,c=0,len; char k; boolean m; File f=new File("info.txt"); FileInputStream f1=new FileInputStream("info.txt"); len=f1.available(); for(i=0;i<=len;i++) { k=(char)f1.read(); c++; System.out.print(k); if(k='/n') { line++; System.out.println(+line); } } System.out.print("number of characters="+c); } }
To skip to a new line when reading from a file, assuming you are using a sequentially organized file, the usual case, you need to read and discard characters until you encounter the end-of-line character.
why does a program consists of more than one object file in c++
edit your autorun.inf file, add the line open=C:\windows\explorer.exe good luck Kevin
program to extract a given word from a file
Just open the file, read-in N bytes and then examine (parse) for known header values or signature.
no
Here's the program: /* Program Start */ #include <stdio.h> int main (void) { FILE *handler; // The "*handler" can be named as anything as you desired char arrText[1000]; handler = fopen("Sampletext.txt", "r"); // We opened a file "Sampletext.txt" ready for reading scanf ("%s", &arrText); // Scan the first line of the file printf ("%s", &arrText); // Display the scanned data from file, to the console fclose (handler); return 0; } /* Program End */ If you wish to print the scanned line to text and not to console, use fprintf insted. fprintf can be executed in this form: fprintf (<file name>, "<format specifier> (or text)", <variable>); Also, use "a" in fopen. This will append the current data to the text file.
yes