Stray '\239' in program

Aug 13, 2008 at 8:26pm
After compiling I get this error message:
'Stray '\239' in program'

I've been programming in C++ for several months, but this is the first time I've had this error message.

Could anyone tell me what it means exactly?

Thank you.
Aug 13, 2008 at 8:38pm
Well if you could try looking up the error code and see if they have any information on it...when I typed in it notepad alt+239 (don't know if thats the same) became "∩"...if that has any significance.
Aug 13, 2008 at 8:44pm
Hi, sorry I don't know how to look up the error code. Will try to find out how to...
Aug 13, 2008 at 8:46pm
Aug 13, 2008 at 9:14pm
Thanks Zaita. I've looked at that. It's to do with the same problem. I've just downloaded a hexedit. To be continued...
Aug 13, 2008 at 9:49pm
This is a great opportunity to play with the STL:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// asciionly.cpp
#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
using namespace std;

#if defined(__WIN32__) || defined(_WIN32_) || defined(__WIN32) || defined(_WIN32) || defined(WIN32)
  #include <cstdio>
  #include <fcntl.h>
  void std_binary_io()
    {
    _setmode( _fileno( stdin  ), _O_BINARY );
    _setmode( _fileno( stdout ), _O_BINARY );
    _setmode( _fileno( stderr ), _O_BINARY );
    cin.sync_with_stdio();
    }
#else
  void std_binary_io() { }
#endif

int main( int argc, char** argv )
  {
  std_binary_io();
  cin >> noskipws;
  remove_copy_if(
    istream_iterator <unsigned char> ( cin ),
    istream_iterator <unsigned char> (),
    ostream_iterator <unsigned char> ( cout ),
    bind2nd( greater <unsigned char> (), (unsigned char)127 )
    );
  return 0;
  }

Run it as:
asciionly < badfile.cpp > goodfile.cpp


Enjoy!
Aug 19, 2008 at 12:42pm
Today I went back to trying to solve this problem, and I was able to using the freeware hexedit.exe.

Using the hexediter I deleted three periods that were before the start of the first line in my file - I couldn't see these three periods via my Code::Blocks software. This solved the problem. - Live and learn!

Thank you for your replies, particularly yours Zaita as it put me on the right track!

Corsican
Topic archived. No new replies allowed.