No Result when run *.exe

This is a discussion on No Result when run *.exe within the C Programming forums, part of the General Programming Boards category; Hello. I have this problem. When I compile a project in the turbo C compiler I can get the result ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    8

    No Result when run *.exe

    Hello. I have this problem. When I compile a project in the turbo C compiler I can get the result that I want. But after I compile it and make it into an exe, then run that exe, I cannot get the result. Why is it when I run in the project file the result is there but not after it is an exe?

    Please asists. Thank you.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,656
    > I cannot get the result.
    Does this mean
    - a different answer
    - no answer
    - program crash?

    A more modern compiler would be a good idea as well, if you want to do anything more than just print stuff to the screen.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,047
    I think "the result" means the source code. So when you open a project file, the source code is visible, but not when you open an exe. Well, that's how it is. I used to back up my exes but now I don't, because the source files are more valuable.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    8
    Hai.....sorry i am a little confuse with the replies given.........The source code is as below.........

    Code:
    #include <stdio.h>
    #include <dos.h>
    
    
    int main()
    {
      int i;
      unsigned char far* scrn = (unsigned char far*) 0xb0008000;
      FILE *fp = fopen("c:\\text.txt","w");
    
      for(i=0;i<6900;i+=2)
         fputc(*(scrn+i),fp);
    
      fclose(fp);
    
     return 0;
    }
    When I press Alt+F9, I get the text.txt with the information on the dos screen. Now I have tested. If I open the dos prompt and straight away type the exe Eg: C:\Scrncap.exe, I won't get the output in the c:\text.txt. The file exist but contains nothing inside. But if I open the turbo C compiler, then close it back again. And then type the exe Eg: C:\scrncap.exe, I get the output of the dos screen in the c:\text.txt. This is the part I really don't understand. Why in a newly open dos prompt I cannot capture the text in the c:\text.txt?

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    8
    Hai.......Thanks for all the support. I have found out the problem. It is not compatible with Win2K dos prompt. When I use another computer with Win98. The program runs well.

    Thanks.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Of course it isn't. You can't just grab any random point in memory on an NT machine and expect it to let you. For one thing, NT doesn't have DOS.

    Oh, and it's your own fault you didn't get a better answer. You didn't mention your OS any place except in your last note.


    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,656
    See, this is the kind of moronic thing which happens when you run some ancient fossil like TurboC on a new operating system.

    Man, there are just so many losers on the board at the moment with dumb-ass TurboC questions. Get with the program people!!!!!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. Need help with basic calculation program.
    By StateofMind in forum C Programming
    Replies: 18
    Last Post: 03-06-2009, 12:44 AM
  3. Promblem with code
    By watchdogger in forum C Programming
    Replies: 18
    Last Post: 01-31-2009, 05:36 PM
  4. Can someone help with my seg fault?
    By John_L in forum C++ Programming
    Replies: 23
    Last Post: 03-01-2008, 03:04 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21