I'm new to windows programing, I have been programming DOS in C for a while now and I was wondering is the code I use there vaild when programming for windows. For example if I wanted to Open and write to a file??
I'm new to windows programing, I have been programming DOS in C for a while now and I was wondering is the code I use there vaild when programming for windows. For example if I wanted to Open and write to a file??
OS:- XP
Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)
Yes, you can use fopen and all the other "dos/console" functions which don't attempt to write to the screen. It is only the output to the screen which requires a different method.
For example
Code:#include <windows.h> #include <stdio.h> int WINAPI WinMain( HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int WinMode ) { FILE *fp; fp = fopen( "Temp.txt", "wt" ); fputs( "Hello World", fp ); fclose( fp ); return 0; }