Please support our C advertiser: Programming Forums
![]() |
•
•
Join Date: Jul 2008
Posts: 26
Reputation:
Rep Power: 0
Solved Threads: 0
I have posted the related topic in the Java forum!
Now, i am having a very differnet problem altogether.
1. i am being able to call the C program from the Java frame using a "Button" in the inteface.
2. But the problem i am facing now is that the printf statement that i wrote in my demo C program is being output only in the Command prompt screen, not in the Text area which i have for the input and output to the C program. As we all know that C returns only int, float double etc. i am facing this problem.
If anybody helps i will be grateful!
Now, i am having a very differnet problem altogether.
1. i am being able to call the C program from the Java frame using a "Button" in the inteface.
2. But the problem i am facing now is that the printf statement that i wrote in my demo C program is being output only in the Command prompt screen, not in the Text area which i have for the input and output to the C program. As we all know that C returns only int, float double etc. i am facing this problem.
If anybody helps i will be grateful!
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
•
•
Join Date: Aug 2008
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
to my knowledge it depends on the compiler your using, i have a borland c compiler, which outputs all programs in cmd, or atleast they must be run from cmd.
but i also have anouther compiler called lcc-win32, which gives the options to open in windows mode, but i dont know enough about C to configure the compiler so im sticking with borland compiler.
so i think your java interface is making a command line only program???
my advice would be to downlaod an actual c compiler for making c programs and use java for java.
but i also have anouther compiler called lcc-win32, which gives the options to open in windows mode, but i dont know enough about C to configure the compiler so im sticking with borland compiler.
so i think your java interface is making a command line only program???
my advice would be to downlaod an actual c compiler for making c programs and use java for java.
Last edited by coolkeg : Aug 7th, 2008 at 2:03 pm.
•
•
Join Date: Jul 2008
Posts: 26
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
to my knowledge it depends on the compiler your using, i have a borland c compiler, which outputs all programs in cmd, or atleast they must be run from cmd.
but i also have anouther compiler called lcc-win32, which gives the options to open in windows mode, but i dont know enough about C to configure the compiler so im sticking with borland compiler.
so i think your java interface is making a command line only program???
my advice would be to downlaod an actual c compiler for making c programs and use java for java.
Thanks a lot, but ur suggestion is of no use to me!
I am using microsoft c, c++ and its command is Cl/LD progname.c try using it.
Last edited by mdew_47 : Aug 7th, 2008 at 3:02 pm.
Jorhat Engineering College, Csc-11/05
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,861
Reputation:
Rep Power: 40
Solved Threads: 1012
•
•
•
•
2. But the problem i am facing now is that the printf statement that i wrote in my demo C program is being output only in the Command prompt screen, not in the Text area which i have for the input and output to the C program. As we all know that C returns only int, float double etc. i am facing this problem.
If anybody helps i will be grateful!
Are these programs run in MS-Windows os? If yes, then when the C program starts you can delete the C's command-prompt window, C program prints everything to a file, then when back to Java program have it read the data file and display the info in its window.
•
•
Join Date: Jul 2008
Posts: 26
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
•
•
•
•
Originally Posted by mdew_47
2. But the problem i am facing now is that the printf statement that i wrote in my demo C program is being output only in the Command prompt screen, not in the Text area which i have for the input and output to the C program. As we all know that C returns only int, float double etc. i am facing this problem.
If anybody helps i will be grateful!
Are these programs run in MS-Windows os? If yes, then when the C program starts you can delete the C's command-prompt window, C program prints everything to a file, then when back to Java program have it read the data file and display the info in its window.
i have completed that part. i am using windows Xp. i brought all the thing to text area and output is given in the text area itself.
but since i am using JNI i am having difficulty changing the C-style string object
to general character array. so that i could perform some operations on it.
i need scan the string between #s <char array> s#. so that i could convert the string between them to capital using strupr. suggestions will be appreciated.
Last edited by mdew_47 : Aug 15th, 2008 at 5:19 am.
Jorhat Engineering College, Csc-11/05
•
•
Join Date: May 2008
Posts: 191
Reputation:
Rep Power: 1
Solved Threads: 11
I must admit I don't know 100% what you're trying to do, but as far as I know, a C-style string object _is_ a general character array. Maybe you can create a function that returns a <char *> and print that to your textbox? Make sure the memory the <char*> is pointing to is valid though.
Last edited by Clockowl : Aug 15th, 2008 at 6:50 am.
•
•
Join Date: Jul 2008
Posts: 26
Reputation:
Rep Power: 0
Solved Threads: 0
i am doing as follows:
if anyone can help i will be very thankful.
# include <C:\j2sdk1.4.2_03\include\jni.h>
# include <C:\Program Files\InstallShield\InstallShield for Microsoft Visual C++ 6\Include\project.h>
# include <stdio.h>
# include <string.h>
JNIEXPORT jstring JNICALL Java_project_test
(JNIEnv *env , jobject obj, jstring s)
{
char (*str)[40] =(*env)->GetStringUTFChars(env,s,0);
int i;
for(i=0;(*str)[0]=='^'&&(*str)[1]=='c';i++)
do{
strupr(str);
}while((*str)[i]!='c'&&(*str)[i+1]!='^');
return((*env)->NewStringUTF(env,str));
(*env)->ReleaseStringUTFChars(env,s,str);
}if anyone can help i will be very thankful.
Jorhat Engineering College, Csc-11/05
![]() |
Similar Threads
Other Threads in the C Forum
- trojans...now nothing opens and I get a paint can't open error (Viruses, Spyware and other Nasties)
- Final Year Project (Computer Science)
- urgent help needed for BE-PROJECT ideas in computer science (C)
- I am MiniGWeek :D (Community Introductions)
- final year project help!!!!! (Computer Science)
- need help with my final year project (Visual Basic 4 / 5 / 6)
Other Threads in the C Forum
- Previous Thread: Print Certain line in C
- Next Thread: Connecting to SQL
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode