User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 397,767 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,476 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
Views: 503 | Replies: 14
Reply
Join Date: Jul 2008
Posts: 26
Reputation: mdew_47 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mdew_47 mdew_47 is offline Offline
Light Poster

compiler as the final year project.

  #1  
22 Days Ago
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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,339
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 20
Solved Threads: 378
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: compiler as the final year project.

  #2  
22 Days Ago
Well how are you calling your C program?

Does Java have anything like popen() as a call?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Join Date: Jul 2008
Posts: 26
Reputation: mdew_47 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mdew_47 mdew_47 is offline Offline
Light Poster

Re: compiler as the final year project.

  #3  
22 Days Ago
Can can get this in the thread i posted in the Java forum, with the same name as this.
Jorhat Engineering College, Csc-11/05
Reply With Quote  
Join Date: Aug 2008
Posts: 8
Reputation: coolkeg is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
coolkeg coolkeg is offline Offline
Newbie Poster

Re: compiler as the final year project.

  #4  
22 Days Ago
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.
Last edited by coolkeg : 22 Days Ago at 1:03 pm.
Reply With Quote  
Join Date: Jul 2008
Posts: 26
Reputation: mdew_47 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mdew_47 mdew_47 is offline Offline
Light Poster

Re: compiler as the final year project.

  #5  
22 Days Ago
Originally Posted by coolkeg View Post
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 : 22 Days Ago at 2:02 pm.
Jorhat Engineering College, Csc-11/05
Reply With Quote  
Join Date: Jul 2008
Posts: 26
Reputation: mdew_47 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mdew_47 mdew_47 is offline Offline
Light Poster

Re: compiler as the final year project.

  #6  
15 Days Ago
i have received what is there in my JAVA interface as a string.

Now i need scan the lines starting with #s and ending with s#. so that i could convert the string between them to capital using strupr. suggestions will be appreciated.
Jorhat Engineering College, Csc-11/05
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,643
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 36
Solved Threads: 867
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: compiler as the final year project.

  #7  
15 Days Ago
Originally Posted by mdew_47 View Post
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 think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Jul 2008
Posts: 26
Reputation: mdew_47 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mdew_47 mdew_47 is offline Offline
Light Poster

Re: compiler as the final year project.

  #8  
14 Days Ago




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 : 14 Days Ago at 4:19 am.
Jorhat Engineering College, Csc-11/05
Reply With Quote  
Join Date: May 2008
Posts: 140
Reputation: Clockowl is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
Clockowl Clockowl is offline Offline
Junior Poster

Re: compiler as the final year project.

  #9  
14 Days Ago
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 : 14 Days Ago at 5:50 am.
Reply With Quote  
Join Date: Jul 2008
Posts: 26
Reputation: mdew_47 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mdew_47 mdew_47 is offline Offline
Light Poster

Re: compiler as the final year project.

  #10  
14 Days Ago
i am doing as follows:

# 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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 4:14 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC