Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 31st, 2006, 7:48 PM   #11
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 1st, 2006, 5:35 AM   #12
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,261
Rep Power: 5 grumpy will become famous soon enough
Quote:
Originally Posted by Ooble
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.
Ah, I misunderstood what you meant.

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.
grumpy is offline   Reply With Quote
Old Sep 3rd, 2006, 1:24 PM   #13
funkey_monkey
Programmer
 
Join Date: May 2006
Posts: 34
Rep Power: 0 funkey_monkey is on a distinguished road
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
funkey_monkey is offline   Reply With Quote
Old Sep 3rd, 2006, 4:39 PM   #14
Keiran
Newbie
 
Join Date: May 2006
Location: uk
Posts: 3
Rep Power: 0 Keiran is on a distinguished road
Send a message via AIM to Keiran Send a message via MSN to Keiran
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..
Keiran is offline   Reply With Quote
Old Sep 6th, 2006, 5:59 PM   #15
funkey_monkey
Programmer
 
Join Date: May 2006
Posts: 34
Rep Power: 0 funkey_monkey is on a distinguished road
Cheers Keiran,

Thanks for that. I'm on my way now
funkey_monkey is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:51 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC