Programming :: Garbage After Exactly Eight Properly Printed Characters?

Jul 21, 2010

The code below prints garbage if I use puts() but it is fine if I use printf() instead (see sample of output at the bottom of this post). The odd thing is that the mess always starts after exactly eight properly printed characters. That sort of regularity can't be a coincidence, can it? It almost looks like an encoding issue (I'm using UTF-8) but if it really is, then I don't understand why the printf() is unaffected.

Code:
#include <stdio.h>
#include <string.h>
const char *nChars (const char *, int);
int main (int argc, char * argv[]){
char * name ="Count Dracula++";
int len = strlen(name);
if (argv[1] == 0) argv[1]="printf";
printf("--->%d characters", len); .....

View 9 Replies


ADVERTISEMENT

Software :: Filter Printed Line To Get Characters Between 2 Expressions?

Jan 28, 2011

I'm having trouble getting a sed command to work. I need to filter a printed line to get characters between 2 expressions. "<job>" and "<url>".

Code:
echo "<job>TEST<url>http://www.project.com/?code=001" | sed 's/^[<job>]*//' | sed 's/[<url>]*$//'
Produces:
Code:
TEST<url>http://www.project.com/?code=001

It takes off the first part but why is that not deleting the "<url>" and all the parts after that?

View 9 Replies View Related

Ubuntu :: Some Japanese Text Comes Out As Garbage Characters

Jan 23, 2010

I have installed scim and anthy. Most Japanese characters display, but some websites and files show garbage characters. Is there any way to resolve this?

View 1 Replies View Related

Ubuntu :: Some Japanese Text Comes Out As Garbage Characters?

Nov 1, 2010

I have installed scim and anthy. Most Japanese characters display, but some websites and files show garbage characters.

View 1 Replies View Related

OpenSUSE :: UTF-8 Characters On Vi / Can't Handle Those Characters Properly

Jun 16, 2010

I have my OpenSuse 11.1 box set up with utf-8, however, every time I try to open a file with utf-8 characters with vi it can't handle those characters properly.

View 6 Replies View Related

Programming :: Modify What Already Printed On The Screen?

May 6, 2011

Now we are implementing our own shell using C++. What upseting us is the history command function, we use an array to store the history commands, and print the when receiving the up and down arrow buttons. The problem is we cannot modify the history command already printed on the terminal, we even cannot move the cursur, let alone modifying the command.

View 1 Replies View Related

Programming :: Garbage Collection In C?

Jan 7, 2010

I was wondering if it is possible to have a garbage collector in C, and would it be too difficult to create?

View 1 Replies View Related

Programming :: Eliminate Garbage From Buffer C++

Mar 4, 2010

Code:
char retBuffer[100];
recv(sock , retBuffer ,sizeof(retBuffer) , 0);

if i send a string smaller then my buffer size retBuffer always have garbage of the end of it....what can i do to eliminate tis problem ?

View 2 Replies View Related

Programming :: Implementing A Garbage Collector In C++?

Aug 27, 2009

I'm interested in writing a generational garbage collector in C++. This is for a Python-like programming language project. I have used Boehm's garbage collector before, but I'm worried that it will have noticeable pause times (unacceptable for interactive programs). Since I can't really find any other C++ established GCs out there, I have been thinking of simply writing my own.

However, there are two essential ingredients I need for this:

- Some kind of write barrier mechanism that will notify my collector when something is written to a part of the heap

- A way for me to know the addresses and sizes of the stack, heap and global storage (the root sets)

how to implement write barriers (and how to get the stack, heap and global storage information) on the Linux platform? As an alternative, if you know of C++ GCs other than Boehm, I would also be interested.

View 14 Replies View Related

Programming :: Ncurses Screen Prints Garbage

Feb 9, 2011

I actually have two reasons for posting this. One is to see if there's an actual name for characters like this:Hopefully that will show up correctly for you. If not, it's a little box with four numbers in it, one in each corner. I don't know their name or their reason for showing up, so it's hard to look for help.

My main problem, though, is that I wrote a program that prints some output to a console using ncurses as it runs. These characters show up on the console, seemingly at random, and disturb the whole thing. Sometimes I'll also get sets of characters like "[13;" I'm not printing anything bizarre on there, just strings and floating-point numbers.

View 6 Replies View Related

Programming :: Write A Driver In C So That When Released The Key Some Message Will Printed In Output Screen?

Nov 22, 2010

I want to write a driver in c so that when i released the key some message will printed in output screen. The driver should be for arm.I have a driver which read the key when it is pressed.But i want the both (means key press and release).

View 3 Replies View Related

Debian :: Japanese Characters Not Displayed Properly

Sep 9, 2011

Debian won't display Japanese characters properly, it shows them as symbols. Is there a language pack or a particular browser plugin I need to install? It's sort of a noobish question, but I looked for something related to this issue in my Package Manager, and didn't find anything that seemed suitable/related.

View 2 Replies View Related

General :: Interpret Keyboard Characters Properly?

Feb 18, 2010

I access a linux server shell via putty, but many of the keys I use do not translate across, up, down, left and right all are seen as ^[[A, ^[[B, ^[[D and ^[[C; But so is C-up, C-down, C-left and C-right. And enter is seen as C-j (which move down to the next line), and backspace is seen as C-h, which is backwards delete.

How can I stop these keys being translated into other keys (so I can, for example, configure C-h and backspace to perform two different functions) and what's doing this translation (Putty, the kernel, the shell)?

View 4 Replies View Related

Programming :: Bash Unset Array Loops GARBAGE?

Jun 27, 2011

Code:

#loop until there are no more files
while [ ${#files[@]} -gt 0 ]; do
for num in `seq 1 ${#files[@]}`; do
wurd=`tail -4 ${files[$num-1]}`

[code].....

Everything works.. but when it has to unset.. it breaks.. it doesnt give an error though.. it just jams the program.

View 7 Replies View Related

Programming :: Make Objects Created With New Garbage-collected

Apr 30, 2011

I read this guide: [URL].. but I still don't understand how to make objects created with new garbage-collected. Could someone explain how or find a link to an explanation?

View 13 Replies View Related

Debian :: Getting Unicode Characters (Japanese) To Display Properly?

Mar 3, 2009

I recently intalled Debian lenny and I'm having issues with some of the unicode characters. Instead of displaying the symbols properly it shows one of the following depending on font/app:

1) Square outline with four letters/numbers arranged inside
2) Just a blank square outline
3) Just a blank space

I haven't been able to test all possible characters, but from a quick check it seems that Cyrillic works properly, Japanese doesn't.A few Google searches later and I'm no wiser on how to fix the issue. Any help?

View 2 Replies View Related

Debian :: Latin-1 Extended Characters Not Properly Shown In GNOME

Nov 13, 2010

Debian "squeeze" AMD64 Some filenames, containing accented or other extended ASCII characters are not shown both in Nautilus and Terminal, nor in Virtual Console.

I also noticed than when asking octave interpreter (ran from terminal) to display character range from 97 to 140 the output was:

On the other hand, when executing the same query in qtoctave the characters are displayed properly.

I've tried to change the font that the gnome terminal uses, to no benefit.

My default locale is en_us.utf8 and I am about to install every package that contains the prefix ttf
thank you for your time reading this

View 3 Replies View Related

Ubuntu :: FBReader Doesn't Display Chinese Characters Properly?

Dec 16, 2010

On Linux Mint FBReader (both the latest version and the one in the 10.04 repositories)displays Chinese characters as boxes(see screenshot) for some reason, but on Windows it works fine. Is there any way to fix it?

View 1 Replies View Related

Programming :: Extra "10" Printed After Every Conversion From ASCII To Int?

Dec 1, 2009

I have a very basic program which I wrote, to print the integer equivalents of an ASCII character. The code is below:

Code:

#include<stdio.h>
int main(void)
{
char c;

[code]....

The code is supposed to take a character as input and print the integer equivalent of that character. But the problem is that, after printing the integer equivalent, it prints an extra '10', every time.

Code:

f
102
10

[code].....

Why does this extra '10' always come? When the code is just a simple:

Code:

#include<stdio.h>
int main(void)
{

[code]....

The code works just fine. There is no extra '10' displayed. I am using Ubuntu 9.10 with gcc-4.4.1.

View 4 Replies View Related

Programming :: Control Characters In C

Feb 16, 2009

I'm working on my ncurses application, written in C. I get user input through a loop which uses getchar(). I was able to recognize Ctrl-n by comparing the keypress to ASCII character 16, and this seems to work fine. However, if I noticed that the ASCII character for Ctrl-j (10) is the same as the Line Feed. I tested this, and if I press enter on the keyboard I get the same ASCII value as when I press Ctrl-j.

So, what do I do if I want Ctrl-j to mean something different in my program than pressing enter?The ncurses terminal mode is set to raw, with a 100 millisecond timeout, and keypad is on (I'm already using the up and down arrow-keys).

View 1 Replies View Related

Programming :: How To Do An Array Of Characters

Feb 18, 2010

I am trying to create an array containing all ASCII characters, how do I create one:

Code:
#!/bin/bash
CHARLIST=( a b c d e f g h i j k l m n o p q r s t u v w x y z

[code]...

View 6 Replies View Related

Programming :: Scramble Characters In AWK?

May 12, 2010

I see I'm finally posting an AWK question rather than an answer for a change I wanted to make an AWK script that would scramble all the characters in each field, but leave the first and last characters where they were.

View 14 Replies View Related

Programming :: How To Truncate Last Two Characters If Its '_1'

Mar 17, 2010

In a file i have to grep for a particular word and cut 8 characters of that word and replace the last characters with space if it is _1.Eg: HP4350_1..i did grep|cut -c 2-9|but didn't know how to truncate the last two characters if its '_1'.i used tr '[_1] '[ ]'.but it replaced all the characters where there is a 'underscore' and 1 instead of'_1' together.

View 5 Replies View Related

Programming :: Stripping Characters Before '=' Delimiter In PHP?

Aug 15, 2010

I'm trying to make a webpage that will display the bash variables I have in a file. These variables are used in a bash script that is run from on my server.The file looks like this:

SERVER=canfs01
SHARE=public
USERNAME=guest

[code]....

View 7 Replies View Related

Programming :: Eclipse And C++ Misrepresentation Of Characters

Mar 3, 2011

I just started using eclipse. Ie, I followed all the instructions to set up C++ and run a simple hello world program.However, I seem to have hit a snag.When I build the solution I get an error. I realized where there should be a > there is a | instead. Every time I type > the | prints instead and I have no idea how to fix this.

View 3 Replies View Related

Programming :: Split A String By Every Nth Characters?

Jan 17, 2011

splitting a string by every nth characters. I'm using Python 2.7.1 because I'm using older libraries, if that matters.

For example, if this is my input:

Quote:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac elit nibh, vitae venenatis ligula. Vestibulum a varius turpis.

Splitting it by every 10th character should produce this list:

Quote:

[ "Lorem ipsu", "m dolor si", "t amet, co", "nsectetur ", "adipiscing", " elit. Sed", " ac elit n", "ibh, vitae", " venenatis", " ligula. V", "estibulum ", "a varius t", "urpis." ]

View 6 Replies View Related

Programming :: Displaying Unicode Characters

Feb 19, 2011

I wrote a java program that writes strings to a file. The strings contain foreign language characters. When I run the program in Windows, the output file shows the foreign characters. However, when I attempt the same operation in Linux, the output file shows a white question mark in a black background instead of the foreign characters. The same Linux system could display the foreign characters if I copy the output file from Windows to Linux. I tried to create the output file using gedit that my program would then add additional strings to and chose Unicode-32 for encoding but still the same problem.

What could I do to get the program to display the foreign language characters from output text file?

View 6 Replies View Related

Programming :: Escape Characters In System?

Nov 11, 2010

My goal is to send escape characters from Linux to make scanner's LED blink. I've started with a simple "beep" command:
echo -e "�7"

and it worked. We are using WaveLink emulator and the escape sequences for the LED are
echo -e "�33%150;200;5L"

Linux returns me this: 150;200;5L
So, it doesn't work. What am I doing wrong for the LED sequences?

View 1 Replies View Related

Programming :: Filter ASCII Characters PHP?

Mar 8, 2010

How can I filter ASCII quotes( ' ) and double quotes ( " ) so that I can replace them with the UTF-8 equivalent?If I copy text from a Word Document(ASCII), and upload it to a web page with PHP. The Database(UTF-8) will replace these racters with incorrect character(s).I need some function that will replace these characters but I don't know how to differentiate the ASCII quotes and the UTF-8 Quotes without (somehow) converting the string to hex, then preg_replace'ing the hex code for the symbol.

View 8 Replies View Related

Programming :: How Renders Unicode Characters?

Oct 13, 2009

I am working on an application that will convert English text into equivalent Indian language text. Since Unicode is the standard, I will be using it. In most of the western languages each code-value directly refers to the glyph index and placing the code-values side by side will give the required display. This one to one mapping is not possible in Indian languages where rendering syllables is required rather than rendering just consonants and vowels. Many of the complex characters are made up by combining several unicode values.

My question here is: How Linux renders this Unicode text correctly? More specifically, what package is used? I believe in Windows they use Uniscribe for rendering.I believe there will be an operating system library for handling the text rendering. Or do I need to write my own rendering engine? How programs like Firefox, GEdit shows unicode text? Do they also have proprietary engines for correct rendering?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved