PDA

View Full Version : c compiler...



ognjen
12-07-2004, 10:09 PM
... do enyone know code for c compiler to run some other file with it... like... when i start it.. then it run c:\2123.exe
ognjen\serbia

sumandeep1984
12-08-2004, 02:09 AM
First which platform are you using?

system : is used to execute some commandline instruction
execlp : is used to invoke a non-returnable process

there are other variations of exec available

try "man execlp" for more details for linux platform.

vikas
12-08-2004, 04:09 PM
Well

What i think you are asking is the hex code to be loaded automatically though some external program ? ... I dont know of any such compiler ... if the support linking to external programs you can give us programs link there

Else try crimson editor connect it with your cmd line compiler and uploader using custom options in it ...should do the trick

ognjen
12-09-2004, 12:09 AM
... thanks guys... now i need code to do something in some precisely time... like do something in 07:30pm....

ognjen
12-10-2004, 03:56 PM
... please, can someone tell me answer on my question... what is code for c compiler which give me possibility to do something is precisely time... somethin like "...outportb(0x378,0x02)... at 14:00h.." THANKS!

ice
12-10-2004, 05:59 PM
ive never tried it,but Turbo C does have a date and time function
You may use 'em
If ur using TC, press shift+F1 to invoke help...

maybe someone else can elaborate

-ice

ognjen
12-10-2004, 11:42 PM
... thanks gerry...

abbyzcool
12-11-2004, 12:21 AM
Hi ognjen,

For triggering the event at a specified time, you'll have to use the date and time functions (defined in time.h) There are lots of ways to do this. Referring the MSDN docs for time.h might help.

Here is the complete code written for VC++ 6.0. To make it work in TC++ 3.0 you'll have to make a few changes.
This program accepts only the time as an input but you can tweak a lil to make it work with the date.
The program accepts time as an input (eg. for 14:00h , put 1400) and then gets the system time and compares both.

Hope this helps, m8!
Get back if ya need more help! :wink:

__________________________________________________ _________

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <windows.h> // For Sleep function

int thour,tmin;

void getsystime(int *thour,int *tmin) //Getting the time
{
char tmpbuf[128];

_tzset(); /*Setting the time xone*/

/* Display operating system-style date and time. */
_strtime(tmpbuf);
printf("OS time:\t%s",tmpbuf);

*thour = atoi(strtok(tmpbuf,":")); //Converting char to int
*tmin = atoi(strtok(NULL,":"));

// _strdate(tmpbuf);
// printf("\nOS date:\t%s\n%d:%d",tmpbuf,thour,tmin);
}

int chktime(int inptime)
{
if(thour == (inptime/100))
{
if(tmin == (inptime-((inptime/100)*100)))
return 1;
}
else
{
return 0;
}
}

int main()
{
int inptime;

printf("\nEnter time (HHMM format): ");
scanf("%d",&inptime);

getsystime(&thour,&tmin);

while(1)
{
if(chktime(inptime))
{
printf("\nEvent triggered.");
/* outportb(0x378,0x02);
break;
*/
}
printf("\r");
getsystime(&thour,&tmin);
Sleep(999);
}

}

__________________________________________________ ___________

ognjen
12-13-2004, 06:19 PM
... thanks, thanks, thanks... i`ll try it now.... thanks man... i have some more questions... i`ll be back...

ognjen
12-13-2004, 06:26 PM
... this is a problem... my program need to work in win xp... i took "inpout32.dll" from net... this will solve the problem... but i dont know how to use it in c compiler... can you help.... THANKS!

ognjen
12-14-2004, 08:40 PM
... i have the problem with the code that you gave me... first i dont have a windows.h and when i try to compile it, it sey:"Function call missing ) in function getsystime"... what to do???? THANKS!

ognjen
12-14-2004, 11:35 PM
... i have solve the problem... but now i have another... it`s :"Expression syntax in function getsystime"... it is about // _strdate(tmpbuf); and // printf("/nOS date:\t%s\n%\d:%d", tmpbuf,thour,tmin);... any ideas... THANKS!

abbyzcool
12-15-2004, 08:03 PM
Hey ognjen,

What compiler are you using?
I got the prog running on VC++ 6.0 , TC 3.0 and Dev C++ 4.9.8!

1) I used "windows.h" just for the Sleep function.
If you are using a compiler other than VC++, you probably dont need windows.h.
You can include "dos.h" and use delay(999) instead of Sleep(999).

This just ensures that the program compares the times after every 999 milliseconds.

2) // _strdate(tmpbuf);
// printf("/nOS date:\t%s\n%\d:%d", tmpbuf,thour,tmin);

these are anyways commented and i dont think you should get a problem with this. I kept it just to show that you can customise the program easily to make it work with dates alongwith time.
So, that part is quite redundant and you can remove it if it's causing some error.

ognjen
12-15-2004, 08:19 PM
... i`m usin tc 2.01... now he showin "Linkin error.."undefined symbol '_strtime' and '_tzset'... oh man what to do...

vikas
12-15-2004, 10:30 PM
Hi

Dont use tc 2.01 though it is free it has lots of functionality missing :( .

ognjen
12-15-2004, 10:52 PM
... where to find v3.0... ?

abbyzcool
12-15-2004, 11:57 PM
go to google and search for "tcpp3full"

ognjen
12-16-2004, 12:07 AM
... i`m downloadin... i`ll try the same code... Thanks!!! You didnt answer me... do you know how to use "inpout32.dll"... my program will need to work under xp... THANKS!!!

ognjen
12-17-2004, 12:13 AM
... o man... is there any smaller compiler on the net (which is good)... conections in serbia are sh*t... Thanks i`ll try the page that you gave me..

sumandeep1984
12-19-2004, 09:07 PM
Hi, for Visual Basic / Visual C++ XP doesnot create much of a trouble but would do for TC

ognjen
12-21-2004, 02:59 AM
... thanks.... i`ll try to get them... i use to make some simply programs in visual basic, but never anything about parallel ports... can you sand me some examples... thanks!!

Rotem
01-06-2005, 09:03 PM
This site might help u:

www.ses.co.il