![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Whenever I compile C or C++ code with GCC, both in Windows and Linux, through GUIs and the command line, it likes a newline at the end of every source or header file. It's always done so. Go figure.
![]() |
|
|
|
|
|
#12 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,261
Rep Power: 5
![]() |
Quote:
When reading a file under unix a CTRL-D character (ASCII value 4) is the end of file marker and a end of line is marked by line feed character (ASCII value 13, normally equivalent to '\n'). When reading a file as text, C functions for reading a line (eg like fgets()) look for an end of line marker to know when to terminate reading, and return an error indicator when they encounter an end of file marker before an end of line marker - therefore most programs discard the last line of the file unless it has a carriage return at the end of it. gcc is a compiler originally targeted at unix flavours, so ..... I misinterpreted your previous post as saying you had to have an additional blank line at the end of a file (eg under unix, a sequence of two end of line markers before the end of file marker - possibly with only white space between them). I've seen some programs written in a way that they look for such a blank line (eg using fgets() until they get a line that contains only whitespace) as a signal to stop reading, and those programs don't check for end of file). Compilers don't tend to do things like that (the technique is a primitive way of allowing a program to save it's state in a text file, but discouraging people from editing that file by hand, as the program will barf if the actual format is wrong - and a lot of text editors strip out whitespace in that form). And MS-DOS (like windows) complicates things more by requiring end of line to be marked by two characters in a text files (a carriage return followed by a line feed) and marking end of file differently. |
|
|
|
|
|
|
#13 |
|
Programmer
Join Date: May 2006
Posts: 34
Rep Power: 0
![]() |
Okay,
I've opened Win Explorer and tried double clicking the application but it just flashes a window briefly on screen and I can see nothing of its contents. Is there no way to execute it from Code::Blocks? Thanks |
|
|
|
|
|
#14 |
|
Newbie
|
open up a command promt:
type 'cd where.you.saved.your.exe' (like 'C:\myhelloworld.exe') then type helloworld.exe and you'll see it.. |
|
|
|
|
|
#15 |
|
Programmer
Join Date: May 2006
Posts: 34
Rep Power: 0
![]() |
Cheers Keiran,
Thanks for that. I'm on my way now ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Installing C++ Compiler Help Wanted | rathjeng1 | C++ | 30 | Jun 20th, 2006 5:20 PM |
| programming outside the compiler | TwilightProgrammers | C++ | 9 | Jun 4th, 2006 6:21 PM |
| [tutorial] Simple G++ compiler tutorial | coldDeath | C++ | 7 | Nov 27th, 2005 1:33 PM |
| DOS Compiler! | Starter | C++ | 11 | Apr 15th, 2005 11:14 PM |
| Newbie : need help with Dev-C++ compiler | gemini_shooter | C++ | 16 | Apr 12th, 2005 4:09 AM |