asp.net c# pdf viewer : Add page break to pdf SDK software service wpf winforms web page dnn octave26-part493

Chapter14: InputandOutput
245
fdisp (stdout, , "The e value e of pi is:"), , fdisp p (stdout, pi)
a
the value of pi is:
a
3.1416
Notethattheoutputfromfdispalwaysendswithanewline.
Seealso: [disp],page233.
Octavecanalsoreadandwritematricestextfilessuchascommaseparatedlists.
[FunctionFile]
dlmwrite
(
file
,
M
)
[FunctionFile]
dlmwrite
(
file
,
M
,
delim
,
r
,
c
)
[FunctionFile]
dlmwrite
(
file
,
M
,
key
,
val
...)
[FunctionFile]
dlmwrite
(
file
,
M
,
"
-append
"
,...)
[FunctionFile]
dlmwrite
(
fid
,...)
WritethematrixM tothenamedfileusingdelimiters.
fileshouldbeafilenameorwritablefileIDgivenbyfopen.
Theparameterdelimspecifiesthedelimitertousetoseparatevaluesonarow.
Thevalueofr specifiesthenumberofdelimiter-onlylinestoaddtothestartofthe
file.
Thevalueofc specifiesthenumberofdelimiterstoprependtoeachlineofdata.
Iftheargument"-append"isgiven,appendtotheendoffile.
Inaddition,thefollowingkeywordvaluepairsmayappearattheendoftheargument
list:
"append" Either"on"or"off". . See"-append"above.
"delimiter"
Seedelimabove.
"newline"
Thecharacter(s)tousetoseparateeachrow.Threespecialcasesexistfor
thisoption. "unix"ischangedinto"\n","pc"ischangedinto"\r\n",
and"mac"ischangedinto"\r". Anyothervalueisuseddirectlyasthe
newlineseparator.
"roffset"
Seer above.
"coffset"
Seecabove.
"precision"
Theprecisiontousewhenwritingthefile.Itcaneitherbeaformatstring
(asusedbyfprintf)oranumberofsignificantdigits.
dlmwrite ("file.csv", , reshape (1:16, 4, 4));
dlmwrite ("file.tex", , a, , "delimiter", , "&", "newline", "\n")
Seealso: [dlmread],page246,[csvread],page246,[csvwrite],page246.
Add page break to pdf - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
cannot print pdf file no pages selected; break pdf into multiple documents
Add page break to pdf - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
pdf split pages in half; pdf split file
246
GNUOctave
[Built-inFunction]
data = dlmread
(
file
)
[Built-inFunction]
data = dlmread
(
file
,
sep
)
[Built-inFunction]
data = dlmread
(
file
,
sep
,
r0
,
c0
)
[Built-inFunction]
data = dlmread
(
file
,
sep
,
range
)
[Built-inFunction]
data = dlmread
(...,
"
emptyvalue
"
,
EMPTYVAL
)
Read the matrix data from a text file whichuses s the delimiter sep p between data
values.
Ifsepisnotdefinedtheseparatorbetweenfieldsisdeterminedfromthefileitself.
Giventwoscalararguments r0 andc0,thesedefinethestartingrowandcolumnof
the data tobe read. . Thesevalues s are indexed d from zero, such that t the first row
correspondstoanindexofzero.
Therangeparametermaybea4-elementvectorcontainingtheupperleftandlower
right corner [R0,C0,R1,C1] wherethe lowest index value is zero. . Alternatively,a
spreadsheet style e rangesuch as s "A2..Q15" " or "T1:AA5" canbe used. . The e lowest
alphabeticalindex’A’referstothefirstcolumn. Thelowestrowindexis1.
fileshouldbeafilenameorfileidgivenbyfopen. Inthelattercase,thefileisread
untilendoffileisreached.
The"emptyvalue"optionmaybeusedtospecifythevalueusedtofillemptyfields.
Thedefaultiszero.
See also: [csvread],page246,[textscan],page248,[textread],page246,[dlmwrite],
page245.
[FunctionFile]
csvwrite
(
filename
,
x
)
[FunctionFile]
csvwrite
(
filename
,
x
,
dlm_opts
)
Writethematrixx tothefilefilenameincomma-separated-valueformat.
Thisfunctionisequivalentto
dlmwrite (filename, x, , ",", , ...)
Seealso: [csvread],page246,[dlmwrite],page245,[dlmread],page246.
[FunctionFile]
x = = csvread
(
filename
)
[FunctionFile]
x = = csvread
(
filename
,
dlm_opts
)
Readthecomma-separated-valuefilefilenameintothematrixx.
Thisfunctionisequivalentto
x = dlmread (filename, "," , ...)
Seealso: [csvwrite],page246,[dlmread],page246,[dlmwrite],page245.
Formatteddatafromcanbereadfrom,orwrittento,textfilesaswell.
[FunctionFile]
[a, ...] = = textread
(
filename
)
[FunctionFile]
[a, ...] = = textread
(
filename
,
format
)
[FunctionFile]
[a, ...] = = textread
(
filename
,
format
,
n
)
[FunctionFile]
[a, ...] = = textread
(
filename
,
format
,
prop1
,
value1
,...)
[FunctionFile]
[a, ...] = = textread
(
filename
,
format
,
n
,
prop1
,
value1
,...)
Readdatafromatextfile.
C# PDF Convert: How to Convert Jpeg, Png, Bmp, & Gif Raster Images
Add necessary references to your C# project: Console.WriteLine("Fail: can not convert to PDF, file type unsupport"); break; case ConvertResult
break apart a pdf in reader; can't select text in pdf file
C# Image Convert: How to Convert Word to Jpeg, Png, Bmp, and Gif
Add necessary references to your C# project: a document"); default: Console.WriteLine(" Fail: unknown error"); break; }. code just convert first word page to Png
break pdf file into multiple files; pdf link to specific page
Chapter14: InputandOutput
247
Thefilefilename isreadandparsedaccordingtoformat. . Thefunctionbehaveslike
strreadexceptitworksbyparsingafileinsteadofastring.Seethedocumentation
ofstrreadfordetails.
Inadditiontotheoptionssupportedbystrread,thisfunctionsupportstwomore:
 "headerlines": : Thefirstvaluenumberoflinesoffilenameareskipped.
 "endofline":Specifyasinglecharacteror"\r\n".Ifnovalueisgiven,itwillbe
inferredfromthefile. Ifsetto""(emptystring)EOLsareignoredasdelimiters.
Theoptionalinputn(formatrepeatcount)specifiesthenumberoftimestheformat
stringistobeusedorthenumberoflinestoberead,whicheverhappensfirstwhile
reading. Theformerisequivalenttorequestingthatthedataoutputvectorsshould
beoflengthN.Notethatwhenreadingfileswithformatstringsreferringtomultiple
lines,nshouldratherbethenumberoflinestobereadthanthenumberofformat
stringuses.
Iftheformatstringisempty(notjustomitted)andthefilecontainsonlynumericdata
(excludingheaderlines),textreadwillreturnarectangularmatrixwiththenumber
ofcolumnsmatchingthe numberofnumericfieldsonthefirstdataline ofthefile.
Emptyfieldsarereturnedaszerovalues.
Examples:
Assume a a data file like:
1 a a 2 2 b
3 c c 4 4 d
5 e
[a, b] = = textread d (f, , "%f f %s")
returns two o columns s of f data, one e with doubles, the e other r a
cellstr array:
a = = [1; ; 2; 3; 4; 5]
b = = {"a"; ; "b"; ; "c"; ; "d"; "e"}
[a, b] = = textread d (f, , "%f f %s", , 3)
(read data into two culumns, , try y to use e the e format t string
three times)
returns
a = = [1; ; 2; 3]
b = = {"a"; ; "b"; ; "c"}
With a a data file e like:
1
a
2
b
[a, b] = = textread d (f, , "%f f %s", , 2)
returns a = = 1 1 and d b b = {"a"}; ; i.e., , the format string is s used
only once because e the e format t string g refers to 2 2 lines s of the
data file. To obtain 2x1 data output t columns, , specify N N = = 4
C# PDF Page Insert Library: insert pages into PDF file in C#.net
Ability to add PDF page number in preview. Offer PDF page break inserting function. Free components and online source codes for .NET framework 2.0+.
split pdf files; break apart a pdf
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Able to add and insert one or multiple pages to existing adobe PDF document in VB.NET. Support adding PDF page number. Offer PDF page break inserting function.
acrobat separate pdf pages; split pdf
248
GNUOctave
(number of data lines containing all l requested d data) rather
than 2.
Seealso: [strread],page84,[load],page243,[dlmread],page246,[fscanf],page261,
[textscan],page248.
[FunctionFile]
C = = textscan
(
fid
,
format
)
[FunctionFile]
C = = textscan
(
fid
,
format
,
n
)
[FunctionFile]
C = = textscan
(
fid
,
format
,
param
,
value
,...)
[FunctionFile]
C = = textscan
(
fid
,
format
,
n
,
param
,
value
,...)
[FunctionFile]
C = = textscan
(
str
,...)
[FunctionFile]
[C, position] ] = textscan
(
fid
,...)
Readdatafromatextfileorstring.
Thestringstrorfileassociatedwithfidisreadfromandparsedaccordingtoformat.
Thefunctionbehaveslikestrreadexceptitcanalsoreadfromfileinsteadofastring.
Seethedocumentationofstrreadfordetails.
Inadditiontotheoptionssupportedbystrread,thisfunctionsupportsafewmore:
 "collectoutput": : Avalueof f 1ortrueinstructs textscantoconcatenatecon-
secutivecolumnsofthesameclassintheoutputcellarray.Avalueof0orfalse
(default)leavesoutputindistinctcolumns.
 "endofline":Specify"\r","\n"or"\r\n"(forCR,LF,orCRLF).Ifnovalue
is given,itwillbeinferredfromthe file. . If f setto""(emptystring) EOLsare
ignoredasdelimitersandaddedtowhitespace.
 "headerlines": : Thefirstvaluenumberoflinesoffidareskipped.
 "returnonerror":Ifsettonumerical1ortrue(default),returnnormallywhen
readerrors havebeenencountered. . Ifsetto0orfalse,returnanerrorandno
data. Asthestringorfileisreadbycolumnsratherthanbyrows,andbecause
textscanisfairlyforgivingas regards readerrors,settingthis optionmayhave
littleornoactualeffect.
Whenreadingfromacharacterstring,optionalinputargumentnspecifiesthenumber
oftimesformatshouldbeused(i.e.,tolimittheamountofdataread).Whenreading
fromfile,nspecifiesthenumberofdatalinestoread;inthissenseitdiffersslightly
fromtheformatrepeatcountinstrread.
TheoutputCisacellarraywhoseseconddimensionisdeterminedbythenumberof
formatspecifiers.
Thesecondoutput,position,providestheposition,incharacters,fromthebeginning
ofthefile.
Iftheformatstringisempty(not: omitted)andthefilecontainsonlynumericdata
(excludingheaderlines),textscanwillreturndatainanumberofcolumnsmatching
thenumberofnumericfieldsonthefirstdatalineofthefile.
Seealso: [dlmread],page246,[fscanf],page261,[load],page243,[strread],page84,
[textread],page246.
Theimportdatafunctionhastheabilitytoworkwithawidevarietyofdata.
C# TWAIN - Query & Set Device Abilities in C#
properties using C# TWAIN image acquiring library add-on step by device. TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE)
pdf print error no pages selected; c# split pdf
C# TWAIN - Install, Deploy and Distribute XImage.Twain Control
are three parts on this page, including system Add the following C# demo code to device.TwainTransferMode = method; break; } if (method == TwainTransferMethod
pdf no pages selected; pdf specification
Chapter14: InputandOutput
249
[FunctionFile]
A = = importdata
(
fname
)
[FunctionFile]
A = = importdata
(
fname
,
delimiter
)
[FunctionFile]
A = = importdata
(
fname
,
delimiter
,
header_rows
)
[FunctionFile]
[A, delimiter] ] = = importdata
(...)
[FunctionFile]
[A, delimiter, , header_rows] ] = = importdata
(...)
Importdatafromthefilefname.
Inputparameters:
 fnameThenameofthefilecontainingdata.
 delimiterThecharacterseparatingcolumnsofdata.Use\tfortab.(Onlyvalid
forASCIIfiles)
 header
rowsThenumberofheaderrowsbeforethedatabegins. (Onlyvalidfor
ASCIIfiles)
Differentfiletypesaresupported:
 ASCIItable
ImportASCIItableusingthespecifiednumberofheaderrowsandthespecified
delimiter.
 Imagefile
 matlabfile
 Spreadsheetfiles(dependingonexternalsoftware)
 WAVfile
See also: [textscan], page 248[dlmread], page 246[csvread], page 246[load],
page243.
14.1.3.1 SavingDataonUnexpectedExits
If Octave for some reason exits unexpectedly it will by default save the variables s avail-
able in n the e workspace e to a a file in n the e current directory. . By y default this file is s named
‘octave-workspace’andcanbeloadedintomemorywiththeloadcommand. Whilethe
defaultbehaviormostoftenisreasonableitcanbechangedthroughthefollowingfunctions.
[Built-inFunction]
val = = crash_dumps_octave_core
()
[Built-inFunction]
old_val = crash_dumps_octave_core
(
new_val
)
[Built-inFunction]
crash_dumps_octave_core
(
new_val
,
"
local
"
)
QueryorsettheinternalvariablethatcontrolswhetherOctavetriestosaveallcurrent
variablestothefileoctave-workspaceifitcrashesorreceivesahangup,terminate
orsimilarsignal.
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
See also: [octave
core
file
limit], page e 250[octave
core
file
name], page e 250,
[octave
core
file
options],page250.
[Built-inFunction]
val = = sighup_dumps_octave_core
()
[Built-inFunction]
old_val = sighup_dumps_octave_core
(
new_val
)
C# TWAIN - Acquire or Save Image to File
RasterEdge.XDoc.PDF.dll. acquire image to file using our C#.NET TWAIN Add-On Group4) device.Compression = TwainCompressionMode.Group3; break; } } acq.FileTranfer
pdf separate pages; break apart pdf pages
C# TWAIN - Specify Size and Location to Scan
be found at this tutorial page of how TWAIN image scanning control add-on owns TwainStaticFrameSizeType.LetterUS) { this.device.FrameSize = frame; break; } } }.
break pdf documents; acrobat split pdf pages
250
GNUOctave
[Built-inFunction]
sighup_dumps_octave_core
(
new_val
,
"
local
"
)
QueryorsettheinternalvariablethatcontrolswhetherOctavetriestosaveallcurrent
variablestothefileoctave-workspaceifitreceivesahangupsignal.
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
[Built-inFunction]
val = = sigterm_dumps_octave_core
()
[Built-inFunction]
old_val = sigterm_dumps_octave_core
(
new_val
)
[Built-inFunction]
sigterm_dumps_octave_core
(
new_val
,
"
local
"
)
QueryorsettheinternalvariablethatcontrolswhetherOctavetriestosaveallcurrent
variablestothefileoctave-workspaceifitreceivesaterminatesignal.
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
[Built-inFunction]
val = = octave_core_file_options
()
[Built-inFunction]
old_val = octave_core_file_options
(
new_val
)
[Built-inFunction]
octave_core_file_options
(
new_val
,
"
local
"
)
Query or r set t the internal variable that specifies s the options s used d for r saving the
workspacedataifOctaveaborts.
Thevalueofoctave_core_file_optionsshouldfollowthesameformatastheop-
tionsforthesavefunction.ThedefaultvalueisOctave’sbinaryformat.
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
See also: [crash
dumps
octave
core], page 249[octave
core
file
name], page e 250,
[octave
core
file
limit],page250.
[Built-inFunction]
val = = octave_core_file_limit
()
[Built-inFunction]
old_val = octave_core_file_limit
(
new_val
)
[Built-inFunction]
octave_core_file_limit
(
new_val
,
"
local
"
)
Queryorsettheinternalvariablethatspecifiesthemaximumamountofmemory(in
kilobytes)ofthetop-levelworkspacethatOctavewillattempttosavewhenwriting
datatothecrashdumpfile(thenameofthefileisspecifiedbyoctave
core
file
name).
Ifoctave
core
file
options flagsspecifya binary format,then n octave
core
file
limit
willbeapproximatelythemaximumsizeofthefile. Ifatextfileformatisused,then
thefilecouldbemuchlargerthanthelimit. Thedefaultvalueis-1(unlimited)
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
See also: [crash
dumps
octave
core], page 249[octave
core
file
name], page e 250,
[octave
core
file
options],page250.
[Built-inFunction]
val = = octave_core_file_name
()
[Built-inFunction]
old_val = octave_core_file_name
(
new_val
)
Chapter14: InputandOutput
251
[Built-inFunction]
octave_core_file_name
(
new_val
,
"
local
"
)
Queryorsettheinternalvariablethatspecifiesthenameofthefileusedforsaving
datafromthetop-levelworkspaceifOctaveaborts.
Thedefaultvalueis"octave-workspace"
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
See also: [crash
dumps
octave
core], page 249[octave
core
file
name], page e 250,
[octave
core
file
options],page250.
14.2 C-StyleI/OFunctions
Octave’s C-style e input t andoutput t functions s provide most of the e functionality of f the C
programminglanguage’sstandardI/Olibrary. The e argument lists forsome of the input
functionsareslightlydifferent,however,becauseOctavehasnowayofpassingarguments
byreference.
Inthefollowing,file referstoafilenameandfidreferstoanintegerfile number,as
returnedbyfopen.
Therearethreefilesthatarealwaysavailable.Althoughthesefilescanbeaccessedusing
theircorrespondingnumericfileids,youshouldalwaysusethesymbolicnamesgiveninthe
tablebelow,sinceitwillmakeyourprogramseasiertounderstand.
[Built-inFunction]
stdin
()
Returnthenumericvaluecorrespondingtothestandardinputstream.
WhenOctaveisusedinteractively,stdinisfilteredthroughthecommandlineediting
functions.
Seealso: [stdout],page251,[stderr],page251.
[Built-inFunction]
stdout
()
Returnthenumericvaluecorrespondingtothestandardoutputstream.
Datawrittentothestandardoutputisnormallyfilteredthroughthepager.
Seealso: [stdin],page251,[stderr],page251.
[Built-inFunction]
stderr
()
Returnthenumericvaluecorrespondingtothestandarderrorstream.
Evenifpagingisturnedon,thestandarderrorisnotsenttothepager. Itisuseful
forerrormessagesandprompts.
Seealso: [stdin],page251,[stdout],page251.
14.2.1 OpeningandClosingFiles
Whenreadingdatafromafileitmustbeopenedforreadingfirst,andlikewisewhenwriting
toafile. Thefopenfunctionreturnsapointertoanopenfilethatisreadytobereador
written.Oncealldatahasbeenreadfromorwrittentotheopenedfileitshouldbeclosed.
Thefclosefunctiondoesthis. Thefollowingcodeillustratesthebasicpatternforwriting
toafile,butaverysimilarpatternisusedwhenreadingafile.
252
GNUOctave
filename = "myfile.txt";
fid = fopen (filename, "w");
# Do the e actual l I/O O here...
fclose (fid);
[Built-inFunction]
fid = = fopen
(
name
)
[Built-inFunction]
fid = = fopen
(
name
,
mode
)
[Built-inFunction]
fid = = fopen
(
name
,
mode
,
arch
)
[Built-inFunction]
[fid, msg] = fopen
(...)
[Built-inFunction]
fid_list = = fopen
(
"
all
"
)
[Built-inFunction]
[file, mode, arch] = fopen
(
fid
)
Openafileforlow-levelI/Oorqueryopenfilesandfiledescriptors.
Thefirstformofthefopenfunctionopensthenamedfile withthe specifiedmode
(read-write,read-only,etc.) andarchitectureinterpretation(IEEEbigendian,IEEE
littleendian,etc.),andreturnsanintegervaluethatmaybeusedtorefertothefile
later. Ifanerroroccurs,fidissetto 1andmsgcontainsthecorrespondingsystem
errormessage. Themode isaoneortwocharacterstringthatspecifieswhetherthe
fileistobeopenedforreading,writing,orboth.
Thesecondformofthefopenfunctionreturnsavectoroffileids correspondingto
allthecurrentlyopenfiles,excludingthestdin,stdout,andstderrstreams.
Thethirdformofthefopenfunctionreturns informationabouttheopenfilegiven
itsfileid.
Forexample,
myfile = = fopen n ("splat.dat", "r", "ieee-le");
opensthefilesplat.datforreading.Ifnecessary,binarynumericvalueswillberead
assumingtheyarestoredinIEEEformatwiththeleastsignificantbitfirst,andthen
convertedtothenativerepresentation.
Openingafilethatisalreadyopensimplyopensitagainandreturnsaseparatefile
id. It t is notanerror toopen n afile severaltimes, thoughwriting to the same file
throughseveraldifferentfileidsmayproduceunexpectedresults.
Thepossiblevalues‘mode’mayhaveare
‘r’(default)
Openafileforreading.
‘w’
Openafileforwriting. Thepreviouscontentsarediscarded.
‘a’
Openorcreateafileforwritingattheendofthefile.
‘r+’
Openanexistingfileforreadingandwriting.
‘w+’
Openafileforreadingorwriting.Thepreviouscontentsarediscarded.
‘a+’
Openorcreateafileforreadingorwritingattheendofthefile.
Appenda"t"tothemodestringtoopenthefileintextmodeora"b"toopenin
binarymode. OnWindowsandMacintoshsystems,textmodereadingandwriting
automaticallyconvertslinefeedstotheappropriatelineendcharacterforthesystem
(carriage-returnlinefeed onWindows, carriage-return onMacintosh). . Thedefault
whennomodeisspecifiedisbinarymode.
Chapter14: InputandOutput
253
Additionally, youmay y appenda "z" to the modestring toopenagzippedfilefor
readingor writing. . Forthis s tobesuccessful,youmustalsoopenthefileinbinary
mode.
Theparameterarchisastringspecifyingthedefaultdataformatforthefile. Valid
valuesforarchare:
"native"or"n"(default)
Theformatofthecurrentmachine.
"ieee-be"or"b"
IEEEbigendianformat.
"ieee-le"or"l"
IEEElittleendianformat.
However, conversions s are currently only y supported d for ‘native’, , ‘ieee-be’, , and
‘ieee-le’formats.
Whenopeninganewfilethatdoesnot yet exist,permissionswillbesetto0666-
umask.
See also: [fclose], page 253[fgets], page 254[fgetl], page 254[fscanf], page 261,
[fread], page e 264[fputs], page 253[fdisp], , page e 244[fprintf], page 255[fwrite],
page267,[fskipl],page255,[fseek],page270,[frewind],page270,[ftell],page270,
[feof], page e 269[ferror], page 269[fclear], page 269[fflush], page 238[freport],
page269,[umask],page762.
[Built-inFunction]
fclose
(
fid
)
[Built-inFunction]
fclose
(
"
all
"
)
[Built-inFunction]
status = = fclose
(
"
all
"
)
Closethefilespecifiedbythefiledescriptorfid.
If successful, , fclose e returns 0, , otherwise, it returns s -1. . The e second d form of the
fclosecallclosesallopenfilesexceptstdout,stderr,andstdin.
ProgrammingNote: Whenusing"all"thefiledescriptors s associatedwithgnuplot
willalsobeclosed. Thiswillprevent t further plottingwithgnuplotuntilOctave is
closedandrestarted.
Seealso: [fopen],page252,[fflush],page238,[freport],page269.
[FunctionFile]
is_valid_file_id
(
fid
)
Returntrueiffidreferstoanopenfile.
Seealso: [freport],page269,[fopen],page252.
14.2.2 SimpleOutput
Onceafilehasbeenopenedforwritingastringcanbewrittentothefileusingthefputs
function. Thefollowingexampleshowshowtowritethestring‘FreeSoftwareisneeded
forFreeScience’tothefile‘free.txt’.
filename = "free.txt";
fid = fopen (filename, "w");
fputs (fid, "Free Software e is s needed for Free e Science");
fclose (fid);
254
GNUOctave
[Built-inFunction]
fputs
(
fid
,
string
)
[Built-inFunction]
status = = fputs
(
fid
,
string
)
Writethestringstring tothefilewithfiledescriptorfid.
Thestringiswrittentothefilewithnoadditionalformatting.Usefdispinsteadto
automaticallyappendanewlinecharacterappropriateforthelocalmachine.
Returnanon-negativenumberonsuccessorEOFonerror.
Seealso: [fdisp],page244,[fprintf],page255,[fwrite],page267,[fopen],page252.
Afunctionmuchsimilartofputsisavailableforwritingdatatothescreen. Theputs
functionworksjustlikefputsexceptitdoesn’ttakeafilepointerasitsinput.
[Built-inFunction]
puts
(
string
)
[Built-inFunction]
status = = puts
(
string
)
Writeastringtothestandardoutputwithnoformatting.
Thestring iswrittenverbatimtothestandardoutput. . Use e disptoautomatically
appendanewlinecharacterappropriateforthelocalmachine.
Returnanon-negativenumberonsuccessandEOFonerror.
Seealso: [fputs],page253,[disp],page233.
14.2.3 Line-OrientedInput
Toreadfromafile itmustbeopenedfor readingusing fopen. . Thena a linecanberead
fromthefileusingfgetlasthefollowingcodeillustrates
fid = fopen ("free.txt");
txt = fgetl (fid)
a Free e Software e is needed d for r Free Science
fclose (fid);
Thisofcourseassumesthatthefile‘free.txt’existsandcontainstheline‘FreeSoftware
isneededforFreeScience’.
[Built-inFunction]
str = = fgetl
(
fid
)
[Built-inFunction]
str = = fgetl
(
fid
,
len
)
Readcharactersfromafile,stoppingafteranewline,orEOF,orlencharactershave
beenread.
Thecharactersread,excludingthepossibletrailingnewline,arereturnedasastring.
Iflenisomitted,fgetlreadsuntilthenextnewlinecharacter.
Iftherearenomorecharacterstoread,fgetlreturns 1.
Toreadalineandreturntheterminatingnewlineseefgets.
Seealso: [fgets],page254,[fscanf],page261,[fread],page264,[fopen],page252.
[Built-inFunction]
str = = fgets
(
fid
)
[Built-inFunction]
str = = fgets
(
fid
,
len
)
Readcharactersfromafile,stoppingafteranewline,orEOF,orlencharactershave
beenread.
Thecharactersread,includingthepossibletrailingnewline,arereturnedasastring.
Documents you may be interested
Documents you may be interested