#include #include #include int main (int argc, char **argv) { printf ("Hello!\n"); /* I don't have cout << in C. I use printf instead. If you want a line break, you have to type it in yourself! */ //Do I even have // comments? for (int i = 0; i<10; i++) printf ("%d\n",i); // cout << "Does this work? " << endl; // This does not work FILE *out; out = fopen ("test.txt","wb"); /* w means open the file for writing==> if the file does not exist, create it. If it does exist, delete it and create a new one b means open the file in binary mode binary mode as opposed to text mode. On a linux machine, the b does absolutely nothing. Eliminate it and nothing changes. On a Windows machine, omitting the b means that everytime \n is written to the file, C will write \r\n to the file. And anytime \r is read, it is ignored. On any computer, every symbol has a code. "codepoint". I have also used "ASCII code" . "A" has a value of 65. "a" is 97. "0" is 48. The digit "9" is 57. The "*" is 42. The "@" is 33. is 32. The newline character also has a number...but that number is operating system dependent. On Linux/Unix, newline is 10. On classic Mac, newline is 13. On Windows, the newline character is actually a two-character combination, 13 followed by 10. */ //fopen, fclose, fprintf are all high-level C methods. They are NOT basic operating system commands, so you won't using these on PG1. fprintf (out, "I\'m in the file!\n"); fclose (out); return 0; }