system command not working in C functions.pls help

Reply

Join Date: Sep 2004
Posts: 12
Reputation: riturajraina is an unknown quantity at this point 
Solved Threads: 0
riturajraina riturajraina is offline Offline
Newbie Poster

system command not working in C functions.pls help

 
0
  #1
Sep 30th, 2004
Dear Friends,

I am developing a small project in which the users have to fill a form from which it will be saved into a database.

Here i wanted to scan a particular folder in the hard-drive contineously so as to know if there is any new file saved in it.

Hence i have written a program(program 1) to do this task and i want to call this program in another c program which collects the data from users and hence while the users are filling the form,the program 1 would contineously scan the hard-drive so as to detect a particular file and if present would flash a message to the user.

I have tried using system command but to no use.

Please help.

Note : I am using Borland Turboc3 3.0 compiler.

Thanks & Regards
Rituraj Raina
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,593
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 710
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: system command not working in C functions.pls help

 
0
  #2
Sep 30th, 2004
>I have tried using system command but to no use.
How did you try it? Is this in a separate thread? Does it not work because of a syntax error or something else? Be as specific as possible and give code examples. Otherwise you'll get nothing but stoney silence.

>Note : I am using Borland Turboc3 3.0 compiler.
Jeez, get a newer compiler. :rolleyes:
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 12
Reputation: riturajraina is an unknown quantity at this point 
Solved Threads: 0
riturajraina riturajraina is offline Offline
Newbie Poster

Re: system command not working in C functions.pls help

 
0
  #3
Oct 1st, 2004
Originally Posted by Narue
>I have tried using system command but to no use.
How did you try it? Is this in a separate thread? Does it not work because of a syntax error or something else? Be as specific as possible and give code examples. Otherwise you'll get nothing but stoney silence.

>Note : I am using Borland Turboc3 3.0 compiler.
Jeez, get a newer compiler. :rolleyes:
Dear Narue,
Here is the section of the code that i used :

#include<cstdlib>
#include <stdio.h>
#include<conio.h>
#include<process.h>


int main(void)
{
clrscr();
printf("About to spawn command interpreter and run a DOS command\n");
system("dir");
getch();
return 0;
}

When executed ,it just shows on the screen the string written in printf when i include file #include<stdlib.h>

When i tried using #include<cstdlib.h> or #include<cstdlib> then it flashes an error: "Unable to include file cstdlib.h or cstdlib.

If you have some solution then kindly help.

Also if i were to upgrade the compiler ,then which compiler should i use and from where i can get one?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 220
Reputation: frrossk is an unknown quantity at this point 
Solved Threads: 9
frrossk's Avatar
frrossk frrossk is offline Offline
Posting Whiz in Training

Re: system command not working in C functions.pls help

 
0
  #4
Oct 1st, 2004
Hi, Riturajraina

I tried your piece of code in Dev-C++ 4.9.9.0 compiler (available for free download at www.bloodshed.net), and it's working just fine (just delete the clrscr command)...
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 220
Reputation: frrossk is an unknown quantity at this point 
Solved Threads: 9
frrossk's Avatar
frrossk frrossk is offline Offline
Posting Whiz in Training

Re: system command not working in C functions.pls help

 
0
  #5
Oct 1st, 2004
I ment replace clrscr() with system ("cls") (it's equivalent, and it does another system call for you )
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,593
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 710
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: system command not working in C functions.pls help

 
0
  #6
Oct 1st, 2004
>If you have some solution then kindly help.
Get a newer compiler. Your problem is that you're trying to use modern C++ with an ancient compiler that doesn't know what modern C++ is.

>then which compiler should i use and from where i can get one?
Dev-C++ is a good one. Search google for Bloodshed's web site where you can download it for free.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 12
Reputation: riturajraina is an unknown quantity at this point 
Solved Threads: 0
riturajraina riturajraina is offline Offline
Newbie Poster

Re: system command not working in C functions.pls help

 
0
  #7
Oct 6th, 2004
Dear Narue/Frrossk,

Thanks for all your help.

I have downloaded Dev compiler and executed the system command which worked fine.

But now i am facing a new problem.

I tried to compile the c++ source code files which i have written in the Turboc3 3.0 compiler .It is flashing a no. of error messages like "In file included in file goto.cpp" etc.

When i compile the same source files in Turboc3 3.0 compiler,then it doesn't display any error messages and the program is executing fine.

I am sorry to trouble you again & again but request you to please get me out of this.

Its a very embarassing situation.

Thanks again
Rituraj
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,593
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 710
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: system command not working in C functions.pls help

 
0
  #8
Oct 6th, 2004
>But now i am facing a new problem.
Post one of the programs that doesn't compile with Dev-C++ and does with Turbo C++. Most likely you're using a library that extension that Dev-C++ doesn't support.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 4
Reputation: memehboob is an unknown quantity at this point 
Solved Threads: 0
memehboob memehboob is offline Offline
Newbie Poster

Re: system command not working in C functions.pls help

 
0
  #9
Jan 14th, 2008
i suppose i may give you a solution. are you an intermediate user of C? if so then try in this way-

1. go to run
2. use command.com to execute
3. go to tc.exe by providing entire path of the TC compiler folder
4. #include<dos.h> in your code and compile your code
5. then go to exit from the TC compiler. file -> exit option
6. now u r in dos prompt again
7. write the name of program exe and then you will find the out put that will show the sub directories of the current directories.

please do let me know whether it worked or not?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,593
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 710
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: system command not working in C functions.pls help

 
0
  #10
Jan 14th, 2008
>please do let me know whether it worked or not?
Factoring in that this thread is four years old and the OP hasn't posted in two years, I'd say that's unlikely.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC