Weird glitch/bug with c++ program compiled in Ubuntu? or am I doing something wrong?
Byron Clark
byron at theclarkfamily.name
Wed Feb 15 15:29:37 MST 2012
On 02/15/12 at 02:54pm, John Shaver wrote:
> On Wed, Feb 15, 2012 at 2:51 PM, John Shaver <bobjohnbob at gmail.com> wrote:
> > Here is a link where you can download the source code.
>
> Forgot the link:
>
> http://jshaver.net/test/source.zip
Looks like tests.txt uses DOS line endings. When you run on Windows
"\r\n" is being returned to you as "\n". On Linux, it isn't. Here's a
patch to fix it (inline so it doesn't get scrubbed):
diff -u source.orig/calc.cpp source/calc.cpp
--- source.orig/calc.cpp 2012-02-14 21:57:33.000000000 -0700
+++ source/calc.cpp 2012-02-15 15:28:03.392211261 -0700
@@ -69,6 +69,10 @@
assert(parenthesis);
f.ignore(1, EOF);
}
+ else if(next == '\r')
+ {
+ f.ignore(1, EOF);
+ }
else if(next == '\n')
{
while(ops.size())
--
Byron Clark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20120215/c2e04a08/attachment.bin
More information about the PLUG
mailing list