| | |
system command not working in C functions.pls help
![]() |
•
•
Join Date: Sep 2004
Posts: 12
Reputation:
Solved Threads: 0
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
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
>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:
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.
•
•
Join Date: Sep 2004
Posts: 12
Reputation:
Solved Threads: 0
•
•
•
•
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:
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?
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)...
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)...
>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.
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.
•
•
Join Date: Sep 2004
Posts: 12
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Jan 2008
Posts: 4
Reputation:
Solved Threads: 0
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?
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?
![]() |
Other Threads in the C Forum
- Previous Thread: About /proc/stat ???
- Next Thread: How to reuse pthreads in C
| Thread Tools | Search this Thread |
#include * adobe ansi array arrays asterisks binarysearch centimeter changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv feet fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez global grade gtkwinlinux hacking histogram inches include incrementoperators infiniteloop input interest intmain() iso kernel keyboard kilometer km license linked linkedlist linux locate looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation owf pattern pdf performance pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable voidmain() wab whythiscodecausesegmentationfault windowsapi







)