if system function shoes error -1 what that's mean, is there any problem like this to save location where it should be save ?
i am using tc , i just make code for dir but not working
Show us your code and we might be able to answer rather than just guessing. But I'm feeling psychic tonight, so I'll guess you are doing something like error = system("dir");
Hmm - that's not going to work is it? "dir" is a built-in command in cmd.exe, not an executable file. Try:
error = system("cmd /c dir");
Of course I could be completely wrong.
Edit: Actually, in retrospect, I may indeed be worng. It's a long time since I used Turbo C as I prefer to use compilers that are younger than myself - and I'm no spring chicken. It could just be that you are trying to run the program from within the IDE. This is a known feature and it means you have run out of memory. Try running the standalone .exe file rather than running in the IDE. Better still, implement your own "dir" function rather than using the DOS one. That will be more efficient and will be educational.
This VC++ compiled program: #include <cstdio> #include <iostream> int main() { std::cout << std::system("echo %CMDCMDLINE%"); return 0; }Returns:C:\Windows\system32\cmd.exe /c echo %CMDCMDLINE% 0
Whereas std::cout << std::system("dirigible"); gives me:'dirigible' is not recognized as an internal or external command, operable program or batch file. 1
Then again, I am using a compiler that's been updated in the last 20 years, so it could very well be yet another compatibility issue with TC.
got it its done now thanks.