Discussion:
named pipe in native code?
zeeshan
2010-02-25 14:41:06 UTC
Permalink
HI Dear,

i am trying to create a named pipe in my native code which i will
access in my java code
here is my sample code to create piple which doesn't work

---------------------------------------------------------------------------
#include <string.h>
#include <jni.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>

/* This is a trivial JNI example where we use a native method
* to return a new VM String. See the corresponding Java source
* file located at:
*
* apps/samples/hello-jni/project/src/com/example/HelloJni/
HelloJni.java
*/
jstring
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
jobject thiz )
{

// mkfifo(const char* path, mode_t mode);
mkfifo("test_fifo", S_IRUSR );
return (*env)->NewStringUTF(env, "Hello JNI !");
}

------------------------------------------------------------------------------------

i have configured cygwin make with my eclipse and when it compiles
this program it gives me error at mkfifo as it doesn't know s_IRUSR

could anybody help me to figure out what is the problem and how can i
solve it
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to android-***@googlegroups.com.
To unsubscribe from this group, send email to android-ndk+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
David Turner
2010-02-25 17:20:49 UTC
Permalink
Please do not cross-post.

You are missing a #include <sys/stat.h> I believe.
Post by zeeshan
HI Dear,
i am trying to create a named pipe in my native code which i will
access in my java code
here is my sample code to create piple which doesn't work
---------------------------------------------------------------------------
#include <string.h>
#include <jni.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
/* This is a trivial JNI example where we use a native method
* to return a new VM String. See the corresponding Java source
*
* apps/samples/hello-jni/project/src/com/example/HelloJni/
HelloJni.java
*/
jstring
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
jobject thiz )
{
// mkfifo(const char* path, mode_t mode);
mkfifo("test_fifo", S_IRUSR );
return (*env)->NewStringUTF(env, "Hello JNI !");
}
------------------------------------------------------------------------------------
i have configured cygwin make with my eclipse and when it compiles
this program it gives me error at mkfifo as it doesn't know s_IRUSR
could anybody help me to figure out what is the problem and how can i
solve it
--
You received this message because you are subscribed to the Google Groups
"android-ndk" group.
To unsubscribe from this group, send email to
.
For more options, visit this group at
http://groups.google.com/group/android-ndk?hl=en.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to android-***@googlegroups.com.
To unsubscribe from this group, send email to android-ndk+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
Continue reading on narkive:
Loading...