Read about how to write data in file in java, The latest news, videos, and discussion topics about how to write data in file in java from alibabacloud.com
. WriteLine ("{0, 7: x}", data [I]);}Fs. Close ();Br. Close ();Console. ReadLine ();}}}
Running effect:
In this example, when you use the Write method of the BinaryWriter object to Write a Double-type variable aDouble to a file, because the parameter is of the Double type, you can call the reload form of
Link Address: http://blog.sina.com.cn/s/blog_4a4f9fb50101p6jv.htmlRecommendation: Chicken Claw female melon seeds male strange like who should reflect on the price of London prices continue to skyrocket XWVQUSRTG Personal Center post message Doudouhe's Blog Http://blog.sina.com.cn/dechuan608hewei [Subscribe][Mobile Subscription] Home Page Blog directory imageAbout MePersonal InformationDoudouheMicro BlogAdd Friends Send a noteWrite a message Add Attention
Blog level:
Blog score:84
/*
Several modes of operation of the file: R: Read-only W: write-only RW: readable and writable
File classification: T: Text file (character file) B: Binary file (byte file)
Atten
-archiving//1. Objects corresponding to the class need to sign Coding//2. Implement write a method//1> Initwithcoder for anti-filing//2> Encodewithcoder for archiving//3. Use Keyedarchiver when archiving//4. Use Keyedunarchiver when anti-archiving//Create a File ManagerNsfilemanager *manager =[Nsfilemanager Defaultmanager]; NSString*filepath = [[Patharray firstobject] stringByAppendingPathComponent:@"10101"
Main Implementation ideas:1. Declare a record to store exported data;2. Use a cursor to retrieve data to the record;3. Use utl_file to write the recorded data into an excel file;4. Perform steps 2 and 3 cyclically to export data.Main problems encountered during the process:1
/*Read and write a set of data to a file in a binary wayThe general method of invocation is:Fread (BUFFER,SIZE,COUNT,FP);Fwrite (BUFFER,SIZE,COUNT,FP);whichBuffer: is an address that, for Fread, is the address of the store where the data read from the file is stored.For fwri
;}}ObjectOutputStream oos = new ObjectOutputStream (New FileOutputStream ("Obj.object"));The serialization of the object. The serialized object must implement the Serializable interface.Oos.writeobject (New Person ("Xiao Qiang", 30));Oos.close ();ObjectInputStream ois = new ObjectInputStream (New FileInputStream ("Obj.object"));The deserialization of the object.Person P = (person) ois.readobject ();System.out.println (P.getname () + ":" + p.getage ());Ois.close ();A brief description of
can see this and filereader no difference, just need to use the other class objects more, can be simple to understand, I want to use is inputstreamreader this thing, so there will be inputstreamreader to let me Reader, So to create a inputstream, and this inputstream is to read the file, so the file read stream to read the file, the internal parameters of the
{ //8*1024 bytes per read $data=fread($FPSRC, 8192); if(!$data) { Break; } Else if(!$isWriteFileOpen) { //The first time the file is read and there is content to create the file $fpDst=fopen($dstPath, "WB"); $isWriteFileOpen=true; fwrite($fpDst,$
Write Java program often encountered to read such as txt or write TXT file, but because to define a lot of variables, often do not remember, every time to check, hereby tidy up, easy to use, convenient understood! Package edu.thu.keyword.test;Import Java.io.File;Import Java.io.InputStreamReader;Import Java.io.Buffer
R language data storage and reading
1. First Use getwd () to get the current directory, and use setwd ("C:/Data") to set the current directory:
2.0 Data Storage: create data box D:
> D
2.1 save as simple text:
> Write. Table (D,
This is to write the data in the following Excel file into the database table of the train ticket booking system. Let's take a look at what Excel Data looks like.
There are two worksheets in this file, and the data is arrang
(), Read.csv2 (), Read.delim (), read.delim2 (). The first two read the comma-delimited data, and the latter two read the other delimiter data.
3.2 More flexible with scan () than read.table ().
But to specify the variable type: For example: C:\data\data.dat:
M 65 168
M 70 172
F 54 156
F 58 163
>mydata
>mydata
3.3 Use READ.FWF () to read some fixed-width
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.