Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122618683
rename.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jul 21, 01:09
Size
688 B
Mime Type
text/x-c
Expires
Wed, Jul 23, 01:09 (2 d)
Engine
blob
Format
Raw Data
Handle
27526967
Attached To
R5163 Slepians
rename.c
View Options
/*
* Copyright (C) 2011, Robert Oostenveld
*
* This implements an atomic rename by calling the UNIX/POSIX operating system command.
*
*/
#include <stdio.h>
#include "mex.h"
#include "matrix.h"
void
mexFunction
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[])
{
char
*
old
,
*
new
;
int
status
;
if
(
nrhs
!=
2
)
mexErrMsgTxt
(
"incorrect number of input arguments"
);
if
(
!
mxIsChar
(
prhs
[
0
]))
mexErrMsgTxt
(
"invalid input argument #1"
);
if
(
!
mxIsChar
(
prhs
[
1
]))
mexErrMsgTxt
(
"invalid input argument #2"
);
old
=
mxArrayToString
(
prhs
[
0
]);
new
=
mxArrayToString
(
prhs
[
1
]);
status
=
rename
(
old
,
new
);
plhs
[
0
]
=
mxCreateDoubleScalar
(
status
);
return
;
}
Event Timeline
Log In to Comment