I'm writing a simple JNI C++ function on a z/OS 1.4 system. I am
attempting to rename a dataset; however, when I use the rename()
function, I get a return code of -1. All of the return codes listed in
the "C/C++ Runtime Library Reference" (EACCES, EINVAL, etc) are
positive integers, and all of them can be successfully input into
strerror() to get a valid error message. Passing -1 to strerror(),
though, just returns a null string.
Has anyone experienced anything similar to this? I'm not sure why I'd
be getting -1 as a return code, and I've been unable to find anything
about it in the manuals or on the web.
Here's an example of my method:
/* This is the signature for a JNI method */
JNIEXPORT jint JNICALL
Java_DatasetUtilities_nativeRenameDataset
(JNIEnv *env, jclass obj, jstring jfrom, jstring jto)
{
int rc;
/* This is JNI code to convert the ASCII Java strings into EBCDIC */
const char *from = (*env)->GetStringUTFChars(env, jfrom, 0);
const char *to = (*env)->GetStringUTFChars(env, jto, 0);
__atoe(from);
__atoe(to);
/* Here, rename() is returning -1 */
rc = rename(from, to);
/* This is just printing out -1 and an empty string */
printf("rename() error (error code: %i, error message: %s)\n",
rc, strerror(rc));
/* More JNI code */
(*env)->ReleaseStringUTFChars(env, jfrom, from);
(*env)->ReleaseStringUTFChars(env, jto, to);
return rc;
} 4 3501
On Thu, 08 Jul 2004 06:53:35 -0700, Jerry Orr wrote: I'm writing a simple JNI C++ function on a z/OS 1.4 system. I am attempting to rename a dataset; however, when I use the rename() function, I get a return code of -1. All of the return codes listed in the "C/C++ Runtime Library Reference" (EACCES, EINVAL, etc) are positive integers, and all of them can be successfully input into strerror() to get a valid error message. Passing -1 to strerror(), though, just returns a null string.
Psst: check the value of errno if the fuction returns -1. This is
somewhat off-topic here; try c.l.c for standard C (which rename () might
be) or a discussion group for z/OS.
--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.
On 8 Jul 2004 06:53:35 -0700, or***@yahoo.com (Jerry Orr) wrote in
comp.lang.c++: I'm writing a simple JNI C++ function on a z/OS 1.4 system. I am attempting to rename a dataset; however, when I use the rename() function, I get a return code of -1. All of the return codes listed in the "C/C++ Runtime Library Reference" (EACCES, EINVAL, etc) are positive integers, and all of them can be successfully input into strerror() to get a valid error message. Passing -1 to strerror(), though, just returns a null string.
Has anyone experienced anything similar to this? I'm not sure why I'd be getting -1 as a return code, and I've been unable to find anything about it in the manuals or on the web.
[snip off-topic java code]
What you have here is not a C++ language issue at all.
You are calling a Java function named remove() in a Java program.
Java is completely off-topic here. Just because Java provides a
function with the name of a standard C and C++ library function does
not make this a C or C++ question.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
This thread is a little old now, but I just want to make sure anyone
reading this in the future can clearly see that it is you, not I, that
is the idiot. You are calling a Java function named remove() in a Java program.
No. I am calling the C function remove() from a C program; I just
happen to be using JNI to call my C program from a Java program.
Java is completely off-topic here.
Yes, it is. That, however, is beside the point, as this is not a Java
question. I simply mentioned Java to provide background as to what I
am doing.
Just because Java provides a function with the name of a standard C and C++ library function does not make this a C or C++ question.
You clearly have no experience in Java, or you would have been able to
quickly realize that the code I displayed was NOT Java, and I'm a
little skeptical about your C/C++ experience if you did not recongnize
that it IS C code.
At any rate, for anyone who may be interested (or for future
seachers), my problem was simply that I was running strerror() on the
return code, when I actually needed to run it on errcode. A silly
mistake that caused me a lot of headache.
Jack Klein <ja*******@spamcop.net> wrote in message news:<c2********************************@4ax.com>. .. On 8 Jul 2004 06:53:35 -0700, or***@yahoo.com (Jerry Orr) wrote in comp.lang.c++:
I'm writing a simple JNI C++ function on a z/OS 1.4 system. I am attempting to rename a dataset; however, when I use the rename() function, I get a return code of -1. All of the return codes listed in the "C/C++ Runtime Library Reference" (EACCES, EINVAL, etc) are positive integers, and all of them can be successfully input into strerror() to get a valid error message. Passing -1 to strerror(), though, just returns a null string.
Has anyone experienced anything similar to this? I'm not sure why I'd be getting -1 as a return code, and I've been unable to find anything about it in the manuals or on the web.
[snip off-topic java code]
What you have here is not a C++ language issue at all.
You are calling a Java function named remove() in a Java program. Java is completely off-topic here. Just because Java provides a function with the name of a standard C and C++ library function does not make this a C or C++ question. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Laura D |
last post by:
How can I identify a carriage return in C++?
\r, \f, \0, \n, \t does not work. I have also tried !isprint(ch), iscntrl(ch), isspace(ch), etc....with no luck!
I even poked around in the MSDN and...
|
by: Jay at SCA |
last post by:
I've been having the following issue with a windows
service I've created in vb.net (.net fw 1.1):
Basically, my service monitors a folder for the creation
of any new files of a particular type...
|
by: Bruce Russell |
last post by:
This may sound stupid but I can't rename the WebForm1.aspx in the
solution explorer.
The file is located in my local web server at
C:\Inetpub\wwwroot\Lab3-VB-Starter\WebForm1.aspx
Is there...
|
by: MSDNAndi |
last post by:
Hi,
I have a set of simple webservices calls that worked fine using .NET
Framework 1.0.
I am calling a Java/Apache based webservices, the calling side is not able
to supply a proper WSDL.
...
|
by: Tony Meyer |
last post by:
On Windows, if I do os.rename(old, new) where old is a file that is
in-use (e.g. python itself, or a dll that is loaded), I would expect
that an error would be raised (e.g. as when os.remove is...
|
by: cheesey_toastie |
last post by:
I have a long query which I have set off and would like to stop, and
rename one of the tables used.
My query is due to my lack of understanding of the underlying
structure of MSSQL-Server...
...
|
by: Ole Mercano |
last post by:
When I create in Designer a new button on my Form it is automatically
named e.g. "button1".
When I doubleclick on it I am directed to the Form.cs where the following
procedure is automatcially...
|
by: heterodon7 |
last post by:
hello,
can anyone give me a clue or simple code on task:
for example we have in 2D an equation fo circle:
(x - 3)^2 + (y - 4)^2 = 25.
now the program must return for example a 40 pairs of...
|
by: dobbine |
last post by:
hi there folks,
I was wondering if I have a folder with the following files in it, can
I return 00012a.jpg?
00012.jpg
00012a.jpg
00012b.jpg
00012c.jpg
right up to ...
00012z.jpg
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |