Chapter36: SystemUtilities
775
Thevariable success is 1ifthedownloadwas successful,otherwiseitis 0inwhich
casemessagecontainsanerrormessage.
If no output argument t is s specifiedandan n error r occurs, , thenthe error r is s signaled
throughOctave’serrorhandlingmechanism.
Thisfunctionuseslibcurl. Curlsupports,amongothers,theHTTP,FTPandFILE
protocols. UsernameandpasswordmaybespecifiedintheURL,forexample:
urlwrite ("http://username:password@example.com/file.txt",
"file.txt");
GETandPOST requests can be specified by y method andparam. . Theparameter
method is s either ‘get’or ‘post’andparamis acellarray of parameter andvalue
pairs. Forexample:
urlwrite ("http://www.google.com/search", "search.html",
"get", {"query", , "octave"});
Seealso: [urlread],page774.
36.4.3 Base64andBinaryDataTransmission
Sometransmissionchannelscannotacceptbinarydata. Itiscustomarytoencodebinary
datainBase64fortransmissionandtodecodethedatauponreception.
[Built-inFunction]
s = = base64_encode
(
x
)
Encodeadoublematrixorarrayx intothebase64formatstrings.
Seealso: [base64
decode],page775.
[Built-inFunction]
x = = base64_decode
(
s
)
[Built-inFunction]
x = = base64_decode
(
s
,
dims
)
Decodethedoublematrixorarrayxfromthebase64encodedstrings.
Theoptionalinputparameterdimsshouldbeavectorcontainingthedimensionsof
thedecodedarray.
Seealso: [base64
encode],page775.
36.5 ControllingSubprocesses
Octaveincludessomehigh-levelcommandslikesystemandpopenforstartingsubprocesses.
Ifyouwanttorunanotherprogramtoperformsometaskandthenlookatitsoutput,you
willprobablywanttousethesefunctions.
Octave alsoprovidesseveralvery low-levelUnix-likefunctionswhichcanalsobeused
forstartingsubprocesses,butyoushouldprobablyonlyusethemifyoucan’tfindanyway
todowhatyouneedwiththehigher-levelfunctions.
[Built-inFunction]
system
(
"string"
)
[Built-inFunction]
system
(
"string"
,
return_output
)
[Built-inFunction]
system
(
"string"
,
return_output
,
type
)
[Built-inFunction]
[status, output] = = system
(...)
Executeashellcommandspecifiedbystring.
Ifthe optionalargument type is "async",theprocessis startedinthebackground
andtheprocessIDofthechildprocessisreturnedimmediately.Otherwise,thechild
Pdf will no pages selected - 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
break pdf into multiple pages; break a pdf into multiple files
Pdf will no pages selected - 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
split pdf; split pdf into individual pages
776
GNUOctave
processisstartedandOctavewaitsuntilitexits. Ifthetypeargumentisomitted,it
defaultstothevalue"sync".
Ifsystemiscalledwithoneormoreoutputarguments,or iftheoptionalargument
return
outputis trueandthe subprocess isstartedsynchronously,thentheoutput
fromthecommandisreturnedasavariable.Otherwise,ifthesubprocessisexecuted
synchronously,itsoutputis sent to the standard d output. . Tosendthe e outputofa
commandexecutedwithsystemthroughthepager,useacommandlike
[output, text] ] = = system m ("cmd");
disp (text);
or
printf ("%s\n", nthargout (2, "system", "cmd"));
Thesystemfunctioncanreturntwovalues.Thefirstistheexitstatusofthecommand
andthesecondis anyoutput fromthecommandthatwaswrittentothestandard
outputstream.Forexample,
[status, output] = = system ("echo foo; exit 2");
willsetthevariableoutputtothestring‘foo’,andthevariablestatustotheinteger
‘2’.
Forcommandsrunasynchronously,statusistheprocessidofthecommandshellthat
isstartedtorunthecommand.
Seealso: [unix],page776,[dos],page776.
[FunctionFile]
unix
(
"command"
)
[FunctionFile]
status = = unix
(
"command"
)
[FunctionFile]
[status, text] ] = = unix
(
"command"
)
[FunctionFile]
[...] = unix
(
"command"
,
"
-echo
"
)
ExecuteasystemcommandifrunningunderaUnix-likeoperatingsystem,otherwise
donothing.
Octavewaitsfortheexternalcommandtofinishbeforereturningtheexitstatusof
theprograminstatusandanyoutputintext.
Whencalledwithnooutputargument,orthe"-echo"argumentisgiven,thentext
isalsosenttostandardoutput.
See also: [dos],page776,[system],page775,[isunix],page789,[ismac],page789,
[ispc],page789.
[FunctionFile]
dos
(
"command"
)
[FunctionFile]
status = = dos
(
"command"
)
[FunctionFile]
[status, text] ] = = dos
(
"command"
)
[FunctionFile]
[...] = dos
(
"command"
,
"
-echo
"
)
ExecuteasystemcommandifrunningunderaWindows-likeoperatingsystem,oth-
erwisedonothing.
Octavewaitsfortheexternalcommandtofinishbeforereturningtheexitstatusof
theprograminstatusandanyoutputintext.
Whencalledwithnooutputargument,orthe"-echo"argumentisgiven,thentext
isalsosenttostandardoutput.
VB.NET TWAIN: TWAIN Image Scanning in Console Application
First, there is no SelectSourceDialog in VB.NET TWAIN console Here we will illustrate the benefits of this VB.NET how to scan multiple pages to one PDF or TIFF
break a pdf file; break pdf
VB.NET PowerPoint: Convert & Render PPT into PDF Document
on and VB.NET PDF editing add-on will be used. As our VB.NET PowerPoint to PDF conversion add-on and edit .pptx document file independently, no other external
pdf splitter; break a pdf into parts
Chapter36: SystemUtilities
777
See also: [unix],page776,[system],page775,[isunix],page789,[ismac],page789,
[ispc],page789.
[FunctionFile]
output = = open file
[FunctionFile]
output = = open
(
file
)
Openthe file file inOctaveor inan externalapplicationbasedonthefile type as
determinedbythefilenameextension.
Recognizedfiletypesare
.m
Openfileintheeditor.
.mat
Loadthefileinthebaseworkspace.
.exe
Executetheprogram(onWindowssystemsonly).
Otherfiletypesareopenedintheappropriateexternalapplication.
[FunctionFile]
output = = perl
(
scriptfile
)
[FunctionFile]
output = = perl
(
scriptfile
,
argument1
,
argument2
,...)
[FunctionFile]
[output, status] = = perl
(...)
InvokePerlscriptscriptfile,possiblywithalistofcommandlinearguments.
Returnoutputinoutputandoptionalstatusinstatus.Ifscriptfileisnotanabsolute
filenameitissearchedforinthecurrentdirectoryandthenintheOctaveloadpath.
Seealso: [system],page775,[python],page777.
[FunctionFile]
output = = python
(
scriptfile
)
[FunctionFile]
output = = python
(
scriptfile
,
argument1
,
argument2
,...)
[FunctionFile]
[output, status] = = python
(...)
InvokePythonscriptscriptfile,possiblywithalistofcommandlinearguments.
Returnoutputinoutputandoptionalstatusinstatus.Ifscriptfileisnotanabsolute
filenameitissearchedforinthecurrentdirectoryandthenintheOctaveloadpath.
Seealso: [system],page775,[perl],page777.
[Built-inFunction]
fid = = popen
(
command
,
mode
)
Startaprocessandcreateapipe.
Thenameofthecommandtorunisgivenby command. . Theargument t modemay
be
"r"
Thepipewillbeconnectedtothestandardoutputoftheprocess,and
openforreading.
"w"
Thepipewillbeconnectedtothestandardinputoftheprocess,andopen
forwriting.
Thefileidentifiercorrespondingtotheinputor outputstreamoftheprocessisre-
turnedinfid.
Forexample:
C# Image: Create C#.NET Windows Document Image Viewer | Online
C# Windows Document Image Viewer Features. No need for viewing multiple document & image formats (PDF, MS Word The following list will give you a broad overview
break up pdf file; break pdf into smaller files
VB.NET Word: Use VB.NET Code to Convert Word Document to TIFF
VB.NET Word to TIFF image converting application, no external Word free to contact us and we will offer you more user guides with RasteEdge .NET PDF SDK using
pdf separate pages; break pdf into pages
778
GNUOctave
fid = = popen n ("ls s -ltr r / | tail l -3", "r");
while (ischar (s = = fgets s (fid)))
fputs (stdout, , s);
endwhile
a
drwxr-xr-x 33 3 root t root 3072 2 Feb b 15 5 13:28 etc
a
drwxr-xr-x
3 root t root 1024 4 Feb b 15 5 13:28 lib
a drwxrwxrwt t 15 5 root t root 2048 8 Feb b 17 7 14:53 tmp
Seealso: [popen2],page778.
[Built-inFunction]
pclose
(
fid
)
Closeafileidentifierthatwasopenedbypopen.
Thefunctionfclosemayalsobeusedforthesamepurpose.
Seealso: [fclose],page253,[popen],page777.
[Built-inFunction]
[in, out, pid] = = popen2
(
command
,
args
)
Startasubprocesswithtwo-waycommunication.
Thenameoftheprocess isgivenbycommand,andargs isanarrayofstringscon-
tainingoptionsforthecommand.
Thefileidentifiersfortheinput andoutputstreamsofthesubprocessarereturned
ininandout.Ifexecutionofthecommandissuccessful,pidcontainstheprocessID
ofthesubprocess.Otherwise,pidis 1.
Forexample:
[in, out, pid] = = popen2 2 ("sort", "-r");
fputs (in, , "these\nare\nsome\nstrings\n");
fclose (in);
EAGAIN = = errno o ("EAGAIN");
done = false;
do
s = = fgets s (out);
if (ischar (s))
fputs (stdout, s);
elseif (errno o () == EAGAIN)
sleep (0.1);
fclear (out);
else
done = = true;
endif
until (done)
fclose (out);
waitpid (pid);
a these
a
strings
a some
a
are
C# HTML5 PDF Viewer SDK deployment on IIS in .NET
This page will navigate users how to deploy HTML5 PDF to the place where you store XDoc.PDF.HTML5 Viewer The site configured in IIS has no sufficient authority
c# split pdf; reader split pdf
VB.NET PDF - VB.NET HTML5 PDF Viewer Deployment on IIS
This page will navigate users how to deploy HTML5 PDF to the place where you store XDoc.PDF.HTML5 Viewer The site configured in IIS has no sufficient authority
split pdf by bookmark; break a pdf into separate pages
Chapter36: SystemUtilities
779
Notethatpopen2,unlikepopen,willnot"reap"thechildprocess. Ifyoudon’tuse
waitpidtocheckthechild’sexitstatus,itwilllingeruntilOctaveexits.
Seealso: [popen],page777,[waitpid],page780.
[Built-inFunction]
val = = EXEC_PATH
()
[Built-inFunction]
old_val = EXEC_PATH
(
new_val
)
[Built-inFunction]
EXEC_PATH
(
new_val
,
"
local
"
)
Queryor settheinternalvariablethatspecifies acolonseparatedlist ofdirectories
toappendtotheshellPATHwhenexecutingexternalprograms.
TheinitialvalueofistakenfromtheenvironmentvariableOCTAVE_EXEC_PATH,but
thatvaluecanbeoverriddenbythecommandlineargument--exec-pathPATH.
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
Seealso: [IMAGE
PATH],page697,[OCTAVE
HOME],page789.
In most cases, the following g functions s simply y decode e their r arguments and make e the
correspondingUnixsystemcalls.Foracompleteexampleofhowtheycanbeused,lookat
thedefinitionofthefunctionpopen2.
[Built-inFunction]
[pid, msg] = fork
()
Createacopyofthecurrentprocess.
Forkcanreturnoneofthefollowingvalues:
> 0
You are e in n the e parent process. . The e value e returned d from m fork k is s the
processidofthechildprocess. Youshouldprobablyarrangetowaitfor
anychildprocessestoexit.
0
Youareinthechildprocess.Youcancallexectostartanotherprocess.
Ifthatfails,youshouldprobablycallexit.
<0
Thecalltoforkfailedforsomereason. Youmusttakeevasiveaction. A
systemdependenterrormessagewillbewaitinginmsg.
[Built-inFunction]
[err, msg] = exec
(
file
,
args
)
Replacecurrentprocesswithanewprocess.
Calling execwithout first calling fork willterminate your current Octave process
andreplaceitwiththeprogramnamedbyfile.Forexample,
exec ("ls" "-l")
willrunlsandreturnyoutoyourshellprompt.
Ifsuccessful,execdoesnotreturn. Ifexecdoesreturn,errwillbenonzero,andmsg
willcontainasystem-dependenterrormessage.
[Built-inFunction]
[read_fd, write_fd, , err, , msg] = pipe
()
Createapipeandreturnthereadingandwritingendsofthepipeintoread
fdand
write
fdrespectively.
Ifsuccessful,erris0andmsg isanemptystring. Otherwise,errisnonzeroandmsg
containsasystem-dependenterrormessage.
Seealso: [mkfifo],page762.
VB.NET TIFF: .NET TIFF Printer Control; Print TIFF Using VB.NET
TIFF document printing add-on has no limitation on VB.NET TIFF printing API will automatically send powerful & profession imaging controls, PDF document, image
break pdf into separate pages; pdf file specification
C# Word: C#.NET Word Rotator, How to Rotate and Reorient Word Page
Remarkably, no other external products, including Microsoft page rotation control SDK will integrate the & profession imaging controls, PDF document, image to
pdf split and merge; break apart a pdf file
780
GNUOctave
[Built-inFunction]
[fid, msg] = dup2
(
old
,
new
)
Duplicateafiledescriptor.
Ifsuccessful,fidisgreaterthanzeroandcontainsthenewfileID. Otherwise,fidis
negativeandmsgcontainsasystem-dependenterrormessage.
Seealso: [fopen],page252,[fclose],page253,[fcntl],page782.
[Built-inFunction]
[pid, status, msg] = waitpid
(
pid
,
options
)
Waitforprocesspidtoterminate.
Thepidargumentcanbe:
1
Waitforanychildprocess.
0
WaitforanychildprocesswhoseprocessgroupIDisequaltothatofthe
Octaveinterpreterprocess.
>0
WaitforterminationofthechildprocesswithIDpid.
TheoptionsargumentcanbeabitwiseORofzeroormoreofthefollowingconstants:
0
Waituntilsignalisreceivedorachildprocessexits(thisisthedefaultif
theoptionsargumentismissing).
WNOHANG
Donothangifstatusisnotimmediatelyavailable.
WUNTRACED
Report the status s of f any childprocesses that are e stopped, , and whose
statushasnotyetbeenreportedsincetheystopped.
WCONTINUE
ReturnifastoppedchildhasbeenresumedbydeliveryofSIGCONT. This
valuemaynotbemeaningfulonallsystems.
Ifthereturnedvalueofpidisgreaterthan0,itistheprocessIDofthechildprocess
that exited. . If f an error occurs, pid willbe less s thanzeroandmsg will contain a
system-dependent error r message. . The e value of status s contains s additional l system-
dependentinformationaboutthesubprocessthatexited.
Seealso: [WCONTINUE],page780,[WCOREDUMP],page780,[WEXITSTATUS],
page 781[WIFCONTINUED], , page e 781[WIFSIGNALED], , page e 781,
[WIFSTOPPED], page 781[WNOHANG], page e 781[WSTOPSIG], , page e 782,
[WTERMSIG],page782,[WUNTRACED],page782.
[Built-inFunction]
WCONTINUE
()
Returnthenumericalvalueoftheoptionargumentthatmaybepassedto waitpid
toindicatethatitshouldalsoreturnifastoppedchildhasbeenresumedbydelivery
ofaSIGCONTsignal.
Seealso: [waitpid],page780,[WNOHANG],page781,[WUNTRACED],page782.
[Built-inFunction]
WCOREDUMP
(
status
)
Givenstatusfromacalltowaitpid,returntrueifthechildproducedacoredump.
This functionshouldonly be employedif WIFSIGNALED returnedtrue. . The e macro
usedtoimplementthisfunctionisnotspecifiedinPOSIX.1-2001andisnotavailable
onsomeUniximplementations(e.g.,AIX,SunOS).
Chapter36: SystemUtilities
781
Seealso:[waitpid],page780,[WIFEXITED],page781,[WEXITSTATUS],page781,
[WIFSIGNALED],page781,[WTERMSIG],page782,[WIFSTOPPED],page781,
[WSTOPSIG],page782,[WIFCONTINUED],page781.
[Built-inFunction]
WEXITSTATUS
(
status
)
Givenstatusfromacalltowaitpid,returntheexitstatusofthechild.
ThisfunctionshouldonlybeemployedifWIFEXITEDreturnedtrue.
Seealso: [waitpid],page780,[WIFEXITED],page781,[WIFSIGNALED],page781,
[WTERMSIG],page 782,[WCOREDUMP],page 780,[WIFSTOPPED],page 781,
[WSTOPSIG],page782,[WIFCONTINUED],page781.
[Built-inFunction]
WIFCONTINUED
(
status
)
Givenstatusfromacalltowaitpid,returntrueifthechildprocesswasresumedby
deliveryofSIGCONT.
Seealso:[waitpid],page780,[WIFEXITED],page781,[WEXITSTATUS],page781,
[WIFSIGNALED],page781,[WTERMSIG],page782,[WCOREDUMP],page780,
[WIFSTOPPED],page781,[WSTOPSIG],page782.
[Built-inFunction]
WIFSIGNALED
(
status
)
Givenstatusfromacalltowaitpid,returntrueifthechildprocesswasterminated
byasignal.
Seealso:[waitpid],page780,[WIFEXITED],page781,[WEXITSTATUS],page781,
[WTERMSIG],page 782,[WCOREDUMP],page 780,[WIFSTOPPED],page 781,
[WSTOPSIG],page782,[WIFCONTINUED],page781.
[Built-inFunction]
WIFSTOPPED
(
status
)
Givenstatusfromacalltowaitpid,returntrueifthechildprocesswasstoppedby
deliveryofasignal.
ThisisonlypossibleifthecallwasdoneusingWUNTRACEDorwhenthechildisbeing
traced(seeptrace(2)).
Seealso:[waitpid],page780,[WIFEXITED],page781,[WEXITSTATUS],page781,
[WIFSIGNALED],page781,[WTERMSIG],page782,[WCOREDUMP],page780,
[WSTOPSIG],page782,[WIFCONTINUED],page781.
[Built-inFunction]
WIFEXITED
(
status
)
Givenstatusfromacalltowaitpid,returntrueifthechildterminatednormally.
See also: [waitpid], page 780[WEXITSTATUS], page e 781[WIFSIGNALED],
page 781[WTERMSIG],page782[WCOREDUMP],page780,[WIFSTOPPED],
page781,[WSTOPSIG],page782,[WIFCONTINUED],page781.
[Built-inFunction]
WNOHANG
()
Returnthenumericalvalueoftheoptionargumentthatmaybepassedtowaitpidto
indicatethatitshouldreturnitsstatusimmediatelyinsteadofwaitingforaprocess
toexit.
Seealso:[waitpid],page780,[WUNTRACED],page782,[WCONTINUE],page780.
782
GNUOctave
[Built-inFunction]
WSTOPSIG
(
status
)
Givenstatusfromacalltowaitpid,returnthenumber ofthesignalwhichcaused
thechildtostop.
ThisfunctionshouldonlybeemployedifWIFSTOPPEDreturnedtrue.
Seealso:[waitpid],page780,[WIFEXITED],page781,[WEXITSTATUS],page781,
[WIFSIGNALED],page781,[WTERMSIG],page782,[WCOREDUMP],page780,
[WIFSTOPPED],page781,[WIFCONTINUED],page781.
[Built-inFunction]
WTERMSIG
(
status
)
Givenstatusfromacalltowaitpid,returnthenumberofthesignalthatcausedthe
childprocesstoterminate.
ThisfunctionshouldonlybeemployedifWIFSIGNALEDreturnedtrue.
Seealso:[waitpid],page780,[WIFEXITED],page781,[WEXITSTATUS],page781,
[WIFSIGNALED],page781,[WCOREDUMP],page780,[WIFSTOPPED],page781,
[WSTOPSIG],page782,[WIFCONTINUED],page781.
[Built-inFunction]
WUNTRACED
()
Returnthenumericalvalueoftheoptionargumentthatmaybepassedto waitpid
toindicatethatitshouldalsoreturnifthechildprocesshasstoppedbutisnottraced
viatheptracesystemcall
Seealso: [waitpid],page780,[WNOHANG],page781,[WCONTINUE],page780.
[Built-inFunction]
[err, msg] = fcntl
(
fid
,
request
,
arg
)
Changethepropertiesoftheopenfilefid.
Thefollowingvaluesmaybepassedasrequest:
F_DUPFD
Returnaduplicatefiledescriptor.
F_GETFD
Returnthefiledescriptorflagsforfid.
F_SETFD
Setthefiledescriptorflagsforfid.
F_GETFL
Returnthefilestatusflagsforfid.Thefollowingcodesmaybereturned
(someoftheflagsmaybeundefinedonsomesystems).
O_RDONLY Openforreadingonly.
O_WRONLY Openforwritingonly.
O_RDWR
Openforreadingandwriting.
O_APPEND Appendoneachwrite.
O_CREAT
Createthefileifitdoesnotexist.
O_NONBLOCK
Non-blockingmode.
O_SYNC
Waitforwritestocomplete.
O_ASYNC
AsynchronousI/O.
F_SETFL
Setthe filestatus flags for fid to the value specified by arg. . The e only
flagsthatcanbechangedareO_APPENDandO_NONBLOCK.
Chapter36: SystemUtilities
783
Ifsuccessful,erris0andmsg isanemptystring. Otherwise,errisnonzeroandmsg
containsasystem-dependenterrormessage.
Seealso: [fopen],page252,[dup2],page780.
[Built-inFunction]
[err, msg] = kill
(
pid
,
sig
)
Sendsignalsigtoprocesspid.
Ifpidispositive,thensignalsig issenttopid.
Ifpidis0,thensignalsigissenttoeveryprocessintheprocessgroupofthecurrent
process.
Ifpidis-1,thensignalsig issenttoeveryprocessexceptprocess1.
Ifpidislessthan-1,thensignalsigissenttoeveryprocessintheprocessgroup-pid.
Ifsigis0,thennosignalissent,buterrorcheckingisstillperformed.
Return0ifsuccessful,otherwisereturn-1.
[Built-inFunction]
SIG
()
ReturnastructurecontainingUnixsignalnamesandtheirdefinedvalues.
36.6 Process,Group,andUserIDs
[Built-inFunction]
pgid = getpgrp
()
Returntheprocessgroupidofthecurrentprocess.
[Built-inFunction]
pid = = getpid
()
Returntheprocessidofthecurrentprocess.
Seealso: [getppid],page783.
[Built-inFunction]
pid = = getppid
()
Returntheprocessidoftheparentprocess.
Seealso: [getpid],page783.
[Built-inFunction]
euid = geteuid
()
Returntheeffectiveuseridofthecurrentprocess.
Seealso: [getuid],page783.
[Built-inFunction]
uid = = getuid
()
Returntherealuseridofthecurrentprocess.
Seealso: [geteuid],page783.
[Built-inFunction]
egid = getegid
()
Returntheeffectivegroupidofthecurrentprocess.
Seealso: [getgid],page783.
[Built-inFunction]
gid = = getgid
()
Returntherealgroupidofthecurrentprocess.
Seealso: [getegid],page783.
784
GNUOctave
36.7 EnvironmentVariables
[Built-inFunction]
getenv
(
var
)
Returnthevalueoftheenvironmentvariablevar.
Forexample,
getenv ("PATH")
returnsastringcontainingthevalueofyourpath.
Seealso: [setenv],page784,[unsetenv],page784.
[Built-inFunction]
setenv
(
var
,
value
)
[Built-inFunction]
setenv
(
var
)
[Built-inFunction]
putenv
(...)
Setthevalueoftheenvironmentvariablevar tovalue.
Ifnovalue isspecifiedthenthevariablewillbeassignedthenullstring.
Seealso: [unsetenv],page784,[getenv],page784.
[Built-inFunction]
status = = unsetenv
(
var
)
Deletetheenvironmentvariablevar.
Return0ifthevariablewasdeleted,ordidnotexist,and-1ifanerroroccurred.
Seealso: [setenv],page784,[getenv],page784.
[Built-inFunction]
homedir = get_home_directory
()
Returnthecurrenthomedirectory.
Onmostsystems,this isequivalentto getenv("HOME"). . OnWindowssystems,if
theenvironmentvariableHOMEisnotsetthenitisequivalenttofullfile(getenv
("HOMEDRIVE"),getenv("HOMEPATH"))
Seealso: [getenv],page784.
36.8 CurrentWorkingDirectory
[Command]
cd dir
[Command]
cd
[Built-inFunction]
old_dir = cd
(
dir
)
[Command]
chdir
...
Changethecurrentworkingdirectorytodir.
Ifdirisomitted,thecurrentdirectoryischangedtotheuser’shomedirectory("~").
Forexample,
cd ~/octave
changesthecurrentworkingdirectoryto~/octave. Ifthedirectorydoesnotexist,
anerrormessageisprintedandtheworkingdirectoryisnotchanged.
chdirisanaliasforcdandcanbeusedinallofthesamecallingformats.
Compatibility Note: : When n calledwith no arguments, matlab prints s the present
workingdirectoryratherthanchangingtotheuser’shomedirectory.
See also: [pwd],page786,[mkdir],page762,[rmdir],page762,[dir],page785,[ls],
page785.
Documents you may be interested
Documents you may be interested