diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-788031A5-75C1-420E-9E2B-71E09FF08ADF.dita --- a/Symbian3/PDK/Source/GUID-788031A5-75C1-420E-9E2B-71E09FF08ADF.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-788031A5-75C1-420E-9E2B-71E09FF08ADF.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,52 +1,52 @@ - - - - - -Example -using <codeph>E32Main()</codeph> -

A simple example using E32Main() as an entry point is -described below. The example writes a text to a file.

-
    -
  • Modify the MMP file as mentioned earlier.

  • -
  • Create a trap handler using CTrapCleanup.

  • -
  • Call the method within TRAPD.

  • -
  • Delete the trap handler.

  • -
-#include <stdio.h> -#include <string.h> -#include <e32base.h> - -void doExampleL(void) -{ - FILE* fd; - char* fileName = "C:\\test.txt"; - char *buf = "Hello world from E32Main()"; - fd = fopen(fileName, "w"); - if (fd == NULL) - { - printf("Unable to open the file (%s)", fileName); - return; - } - if (fwrite(buf, sizeof(char), strlen(buf), fd) < 0 ) - { - perror("write fails."); - } - fclose(fd); -} - -GLDEF_C TInt E32Main() - { - CTrapCleanup* cleanup=CTrapCleanup::New(); - TRAPD(error,doExampleL()); - delete cleanup; // destroy cleanup stack - return 0; // and return - } - + + + + + +Example +using <codeph>E32Main()</codeph> +

A simple example using E32Main() as an entry point is +described below. The example writes a text to a file.

+
    +
  • Modify the MMP file as mentioned earlier.

  • +
  • Create a trap handler using CTrapCleanup.

  • +
  • Call the method within TRAPD.

  • +
  • Delete the trap handler.

  • +
+#include <stdio.h> +#include <string.h> +#include <e32base.h> + +void doExampleL(void) +{ + FILE* fd; + char* fileName = "C:\\test.txt"; + char *buf = "Hello world from E32Main()"; + fd = fopen(fileName, "w"); + if (fd == NULL) + { + printf("Unable to open the file (%s)", fileName); + return; + } + if (fwrite(buf, sizeof(char), strlen(buf), fd) < 0 ) + { + perror("write fails."); + } + fclose(fd); +} + +GLDEF_C TInt E32Main() + { + CTrapCleanup* cleanup=CTrapCleanup::New(); + TRAPD(error,doExampleL()); + delete cleanup; // destroy cleanup stack + return 0; // and return + } +
\ No newline at end of file