Thread: confusion win32 -console app

  1. #1
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    between photons and phonons

    confusion win32 -console app

    Im getting confused i check the msdn library and see that there are functions for win32 apps to open files and handle 'em.
    #include <windows.h>
    #include <stdlib.h>
    #include <stdio.h>
    int WINAPI WinMain()
      return 0;
    int open_file(){
      FILE *fl;
      fl=fopen("C:\\windows\\desktop\\shutd.txt", "w");
      if(fl == NULL ){
           printf("Couldnt create file\n");
             fprintf(fl,"Apparently this is working\n");
             printf("It worked");
      return 0;
    As you can see its a win32 application. Now how come that this does creates a file called shutd.txt containing the line "Apparently this is working" but doesnt displays my message ( It worked).... i mean how do you know if a function can be used in a win32 application or not, i could use the functions from the msdn library to open a file or i could use the functions according to the ANSI C... wich do you choose.
    Since ive always programmed for console app ive never had to deal with functions like " public static File open( String path )---according to the msdn lib"....
    Any link or suggestion that can clear the sky for me would be welcome.

    P.S: Dont be too hard for me when u'v read this like "WHAa what an idiot." ( I'm just a kiddo trying to learn )

  2. #2
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    between photons and phonons
    Thx Salem...
    I'm probably thinking a little bit too much about everything .

  3. #3
    Registered User Xei's Avatar
    Join Date
    May 2002
    There is no console screen in a Win32 Interface; thus, no text is displayed. Use the MessageBox function instead.

    edit: Also, now that your into Win32 programming, you might want to look up how to use Debug features of the compiler that you are using, such as the various Watch-Windows.
    Last edited by Xei; 06-11-2003 at 10:34 AM.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading from a win32 console window.
    By knave in forum C++ Programming
    Replies: 4
    Last Post: 04-24-2003, 02:23 PM
  2. win32 and consele app.
    By master2000 in forum C++ Programming
    Replies: 5
    Last Post: 12-22-2002, 11:50 AM
  3. Is it possible to get a console up with a win32 app?
    By SilentStrike in forum Windows Programming
    Replies: 2
    Last Post: 12-18-2001, 05:15 PM
  4. Displaying BMP in DJGPP (Win32 Console)
    By CBGMan in forum C++ Programming
    Replies: 1
    Last Post: 11-03-2001, 01:59 PM
  5. Turning a Console APP into Windows.
    By Darkflame in forum C++ Programming
    Replies: 3
    Last Post: 09-14-2001, 03:10 AM