C++ :: Printing Chinese / Unicode Characters To Line Printer Using WritePrinter Method?

Jul 10, 2013

I'm trying to print Chinese/unicode characters to a line printer(EPSON LQ-2090) using the writePrinter method in c++.

ANSI characters print fine, but when I throw the buffer of widechar Chinese characters at it, they come out like garbage/ANSI chars.

while debuging string shows chinese characters but in memory it shows ANSI characters not chinese and these ANSI characters are get printed on printer.

Note that if I change the DocInfo datatype parameter to "TEXT" instead of "RAW" then also the Chinese characters donot print.

Is there a way to get Chinese or unicode characters to print correctly?

View 6 Replies


ADVERTISEMENT

C++ :: Printing Unicode Characters With Key IDs

Feb 5, 2013

I want to print out unicode characters. But I want to do this using the key ids. Example:

int main()
{
std::cout << ('124'); //I would like this to output '|'
}

View 2 Replies View Related

C/C++ :: Printing Out Unicode Hex As Chars

Feb 10, 2014

I'm writing a school assignment that writes/reads user input into and out of a binary file.

I've gotten the write part to work, but now I need to be able to read that file back in and display it as a string.

I think I should be using fread() and read my file into an array of int's right? But when I try printing out that array I get a whole bunch of numbers that don't match the hex code in my file.

How do I read in a binary file and print it out as a string?

View 4 Replies View Related

C++ :: How To Use Unicode Characters

Jan 25, 2015

I'm trying to have a button marked by the sqrt sign, '√'.

I wrote below code and typed that sign by holding down "alt" and typing 251 using numpad. But result is the question mark instead of sqrt mark!

My machine is Windows 7 x86 and IDE is visual studio 2012.

#include <GUI.h>
using namespace Graph_lib;
//---------------------------------
class Test : public Window {
public:
Test(Point, int, int, const string&);

[Code] .....

View 3 Replies View Related

C/C++ :: Reading Unicode Characters From File?

Feb 28, 2012

I need to read Unicode characters from a file. The only thing I need to do from them is to extract their Unicode number.

For example if file has u I need to extract its corresponding Unicode number.

View 3 Replies View Related

C++ :: Decoding Unicode Characters To String

Jan 6, 2013

I'm having some problems in receiving fileNames from Server to Client(C++) in Mac OS X. I send a serialized object , which has a char pointer with the fileName or sometimes a string object, when i receive it in the client, it seems to be having %F6 or %E9 ,etc . This issue don't arise in Windows OS though, even thought it's the same code. Is there anyway decoding these '%' characters back to their original form in Mac OS & Linux ..?

Fex characters i got into problems with : ǡ ȅ ȉ

It would be difficult to change the code in server, so if there's a way decoding the characters back to its original form, it would be easier.I'm using Boost Library for Serialization and i'm just looking for ways to decode %F6 back to ȅ in C++, like if some library is available ..?

View 1 Replies View Related

C/C++ :: Printing Barcode On Cognitive HCLabel Printer From Windows Server 2008?

Oct 10, 2012

I am trying to print a barcode form HClabel printer through my application running on Windows server 2008. The printer is a ntwork printer connected to a Windows 7 Machine.

The code to access the printer and proceed with printing is in VC++. The code has been working fine since years and it still works when I try to print from Windows XP machine(Connect and print on the same printer connected to WIndows 7 machine mentioned above).

The error code I receive when tried to print from windows server 2008 is 2 which says File not found. But when i access the machine from windows server 2008, it is accessible.

Below is the code I use:

if( m_hPrinter != NULL )
        EndWriter();  
    m_hPrinter = ::CreateFile(lpPrinterName,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );  
    if( m_hPrinter == INVALID_HANDLE_VALUE )  

[Code] .....

what might be causing this to fail-only on the new operating system I use(Windows server 2008)

View 4 Replies View Related

C++ :: How To Send UNICODE Characters To Serial Port

Jul 17, 2013

I am trying to write data in Russian language to the serial (RS-232) port. My display device is already set to that character code page.

But output on the device is not exactly what I require.

My code snippet is like this below

CString pBuffer = L"английский"; //Russian Language
LPBYTE pByte = new BYTE[pBuffer.GetLength() + 1];
memcpy(pByte, (VOID*)LPCTSTR(pBuffer), pBuffer.GetLength());
long nBuffer=pBuffer.GetLength()+1;
DWORD dwWritten=0;
WriteFile(pHandle , pByte, nBuffer ,&dwWritten , NULL);

pHandle is a valid handle.

View 4 Replies View Related

C++ :: Open File Named In Unicode Characters

Sep 22, 2012

How to open a file which its name is unicode letters ? usually :

Code:
basic_ifstream<wchar_t> src("source.txt");

Work well to read file with unicode content not filename, so that example doesn't work :

Code:
basic_ifstream<wchar_t> src(L"source.txt");

Also, I have seen some alternatives for using open function but it doesn't work as well.

Code:
basic_ifstream<wchar_t> src;
src.open(L"source.txt");

I use g++ compiler.

View 3 Replies View Related

C Sharp :: How To Display Urdu Unicode Characters On Windows Forms

Aug 3, 2012

I tried to get the Urdu Fonts from MySql Database using C# in Visual Studio 2010 in Windows Forms Application. When I get the value from table into my variable it shows the characters in ???? symbols. But in PHP i have used the following code:

<?php 
class CRUD {
var $con; 
//function to make connection to database

[Code].....

View 3 Replies View Related

C# :: Using Split Method To Parse Line In CSV File

Jun 6, 2014

I'm using the Split method to parse line in a csv file. The following code works if there are no commas in the text of my data.

string csvLine;
string[] splitLine;
csvLine = "Jim Borland,1234,Never dreams in code";
splitLine = csvLine.Split(',');

But if I have commas in the some of the text as below I get then wrong output. So I need split on a commas which are not enclosed in double quotes.

string csvLine;
string[] splitLine;
csvLine = ""Jim,C,Borland",1234,"Never dreams in code"";
splitLine = csvLine.Split(',');

The output I want is:

Jim,C,Borland
1234
Never dreams in code

I found this :

If your strings are all well-formed it is possible with the following regular expression:

String[] res = str.split(",(?=([^"]|"[^"]*")*$)");

The expression ensures that a split occurs only at commas which are followed by an even (or zero) number of quotes ... and thus not inside such quotes).

Nevertheless, it may be easier to use a simple non-regex parser.

But the .split gives me an error and .Split doesn't work either.

View 5 Replies View Related

Visual C++ :: Getting Unicode From API DLL Using Non-Unicode Program

Aug 29, 2013

I have some code that was compiled without Unicode turned on in the Preprocessor Definitions. I need to access an API that had Unicode turned on in the Preprocessor Definitions (I believe that it is on by default for DLL's) .

I need to call a function in the DLL that requires a structure like:

struct READERINFO {
TCHAR serial[32];
TCHAR altSerial[32];
TCHAR name[32];
TCHAR fccId[48];
TCHAR hwVersion[16];
int swVerMajor;
int swVerMinor;
char devBuild;
};

It returns some information in the structure some of it is Unicode based however the program that is calling it is not Unicode. The preprocessors are not turned on because if they were there would be a lot of things to change in this code. The code is old code that I inherited and now I must interface to some new devices.

I declare my structure as :

READERINFO info; Then I call the function in the DLL which looks like: ApiGetReaderInfo(hAPI, &info, sizeof(into));

Which is defined as:
ApiGetReaderInfo(HANDLE hApi,
Struct READERINFO * ri,
DWORD riSize);

Parameters:

hApiHandle to valid Api object instance
riPointer to the READERINFO structure.
riSizeSize of ri structure in bytes. Usually: sizeof(struct READERINFO).

When I call it from my program that does not have UNICODE defined in the Pre-Processors I get :

Characters like : ÌÌÌÌÌ in the TCHAR fields and invalid numbers in the integer fields.
int ModuleVersion(HANDLE hApi) {
struct READERINFO info;
ApiGetReaderInfo(hApi, &info, sizeof(info));

[Code] ....

When I call it from my program that has some sample code just for this and has the UNICODE defined in the Preprocessors it works just fine. how I can call this from my old code and get the correct information. I have already tried to do the follow without success:

int ModuleVersion(HANDLE hApi) {
#define UNICODE
struct READERINFO info;
#undef UNICODE
ApiGetReaderInfo(hApi, &info, sizeof(info));

[Code] .....

View 4 Replies View Related

C :: Reading And Printing In A Specific Format Strings Of Characters And Integers

Feb 23, 2015

I have been skimming and searching but dont know how to word the search just right to find what I need to know. I have written simple stuff with the support of tutorials like weight conversion or loops counting up to a set number. Nothing amazing. The other day I found out how to input and print a string rather than a single text character which i though was bad ass. I even got it to read multiple strings on a single line and found a way to read multiple lines. I can even format it to read both integers and characters on the same line as long as I know the predefined format.

On to my question... How do I read multiple lines with both carecters and integers. for instance:

nissan 1996
toyota 1998
or more comples like
nissan gtr 1996
toyota markii 1998

I want to use
int year;
char make[10]; maybe need to use char make[10][10]; for an array i would guess.
char model[10]; optional for the extra data

but reproduce what i read in a different order. say...
1996 nissan
1998 toyota
vice the original format.

this is what I have tried.

Code: scanf("%s %s", &make,&year);

//The way I seen to read multiple lines was on here

scanf("%[^/t]", %make);

But this wont let me separate the two into two differnet definded data types. Let alone use printf to display them in reverse order.

View 1 Replies View Related

C++ :: Printing 10 Numbers Per Line?

Nov 3, 2013

I'm working on a program that prints every even number from 100 to 200. How i would be able to print 10 numbers per line?

Code:
#include <iostream>
using namespace std;
int main()
{
int x;
for (x=100; x<=200; x++)
cout <<x++<< endl;
system("pause");
return 0;
}

View 2 Replies View Related

C++ :: Printing Vector Adding New Line

Oct 10, 2013

I have a vector of structs.

struct myStruct{
string text;
int num;
};

vector<myStruct> foo;

And I am attempting to print the text followed by a space, then the number. Like so:

foobar 5

But when trying to print my vector using

ofstream outputFile;
outputFile.open ("file.txt");
for(int i = 0; i < foo.size(); i++) {
outputFile << foo[x].text << " " << foo[x].num << endl;
}

It prints like

foobar
5
moretext
8

With an extra newline and space. How to get rid of it and print it on the same line.

I have checked that text does not include new line character at the end. Also, it seems to print correctly using cout, but not print correctly to output file...

View 1 Replies View Related

C++ :: Output New Line Every 10 Characters

Feb 5, 2013

void printList(int list[],int cnt,int numsPerLine){
for(int i=0;i<cnt;i++){
cout<<list[i]<<" ";
if((i%numsPerLine)==0)
cout<<"
";
} }

So cnt is 20, numsPerLine is 10, and list[] is initialized with a const = 20

i%numsPerLine on the first loop equals 0 and thus outputs a new line.

I'd like it to new line after 10.

View 1 Replies View Related

C# :: Printing All Values Above The Diagonal Line In 2D Array

Apr 11, 2014

I need to print all the values in a square 2d array that are above the diagonal line. So if I have this 6x6 array for instance:

{0,0,0,0,0,0},
{1,1,1,1,1,1},
{2,2,2,2,2,2},
{3,3,3,3,3,3},
{4,4,4,4,4,4},
{5,5,5,5,5,5}

I'd have to print the elements in italics. I've tried this:

for (i = 1; i < a.GetLength(0); i++) {
for (j = i-1; j >=0; j--)
Console.Write("{0,-2}", a[i, j]);
Console.WriteLine();
}

with the array mentioned above but for some reason it keeps printing the elements BELOW the line, when I need it to print those above it. I know that for arrays we usually start loops with a value of 0 but seeing as there should be nothing to print at [0,0] I started the loop at 1.

View 2 Replies View Related

Visual C++ :: Printing 2 Arrays With 10 Numbers Per Line

Jan 14, 2014

i got 2 arrays, how would i print 10 numbers per line, so that would be 5 numbers from each array.

array1[40];
array2[40];

array1 array2// array1 array2// array1 array2 // array1 array2 // array1 array2
array1 array2// array1 array2// array1 array2 // array1 array2 // array1 array2
array1 array2// array1 array2// array1 array2 // array1 array2 // array1 array2

...... and so on

how can i put this in a loop?

and so on but there are 80 elements so i cant go one by one.

View 5 Replies View Related

C++ :: Ncurses - Highlighting A Line Of Characters On Screen

Oct 25, 2013

I am writing a program using ncurses that needs a function to highlight a line of characters on the screen. I started writing this function that took the x & y coordinates of a character on the screen and the length of characters after that to highlight. Whilst doing this I noticed that if I highlighted the last character in a row (maxX-1 in my example) it highlighted that character (as expected), and if I highlighted just the character before that (maxX-2) it also works. But if I do both, it highlights the whole row/line. Also, if there are characters in those spaces other than the 'space' character it works too, but for my program I need to be able to highlight empty spaces as well.

To highlight I am using inch() to get the character and addch() to print it because I am using some alternate characters that chgat() replaces with normal characters.

#include <ncurses.h>
int main(){
initscr();
start_color();
use_default_colors();
curs_set(0);
noecho();

int maxX=0, maxY=0;

[Code] ....

View 3 Replies View Related

C/C++ :: Parsing Integers And Characters From A Single Line?

Mar 10, 2015

parsing integers and characters in same line.

I trying to parse g8,7.

{
token = strtok(NULL, ",");
token2 = strtok(NULL, "g");
}

I am trying to make 8 an integer so that i get two integers 8 and 7.

I already know how to get 7, but every time i do it i get (0,7) instead of (8,7).

View 8 Replies View Related

C :: Program To State User Chinese Zodiac And Horoscope Sign After Inputting Birthday

Mar 26, 2013

I am a beginner trying to write a program that would state a user's chinese zodiac and horoscope sign after inputing his or her birthday. I have been, however, having trouble getting the program to run correctly.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define CAPRICORN "G"
#define AQUARIUS "W"
#define PISCES "F"

[Code] ......

View 3 Replies View Related

C++ :: Undefined Reference To (method Name) When Accessing Method In Static Library

Jan 17, 2013

I've been trying for more than one month to access a method found in a library called libcocosnas_static.a. I'm using Cocos2d-X version 2.0.4. The library has been used many times by my company to make games using cocos2d-1.0.1-x-0.12.0 without any problem.

This is what I've done:
1- I added the include paths of the library to both eclipse and Android.mk
2- Included the .h file using #include "NASPlatformUtil.h"
3- Added the libcocosnas_static.a file to the proj.androidobjlocalarmeabi folder
4- Added "LOCAL_WHOLE_STATIC_LIBRARIES += cocosnas_static" to the Android.mk file
5- Called the function using: NASPlatformUtil:: openUrl("http://xxx.xxx.com/");

I can right click on the function, click Open Declaration and get it without any problem, but the compiler keeps on giving me that dreaded error...

View 3 Replies View Related

C :: Using A Printer In ANSI

Oct 29, 2014

Is there a way to access the printer in ANSI C ?

I have written a program and would like to print out the data (held in a file).

All I can find is that there seems to be no way to send a file to the printer and stay within the confines of ANSI C.

I am restricting my use to ANSI specs for the portability. Do I have any options?

View 1 Replies View Related

C++ :: How To Get Information About Printer

May 21, 2014

The problem is when i run this program and program is stop working but the output is out.

#include <iostream>
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <conio.h>
using namespace std;
void EnumeratePrinters(DWORD flags);

[Code] ....

View 6 Replies View Related

C++ :: USB Printer Detection?

May 16, 2014

take a look at this project : [URL] i want to change this project for this purpose : when a USB PRINTER is connected show a message that tell us -> hey this is a printer. which part of this project should i change and how can i separate printer devices from the others?

note: if you are using visual studio 2010 or higher and get error for this line after conversion :

#define _WIN32_WINNT 0x403

just replace all of such these lines to stdafx.cpp file. means stdafx.cpp at last should be like this :

// stdafx.cpp : source file that includes just the standard includes
// HWDetect.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#define _WIN32_WINNT 0x403
#include "stdafx.h"

View 1 Replies View Related

C++ :: Pass Method Of Derived Class As Parameter To Another Method In Base Class?

Feb 2, 2015

I have a question similar to the one here: [URL] .....

The main difference is I would like to pass a method of derived class as a parameter to some other method in its template base class.

template <typename BaseType>
class Base {
public:
typedef void (Base::*Callback)(int A);

[Code] .....

The above is an example which does not compile. My compiler complains that the two BaseMethod() calls in DerivedMethod() are invalid uses of non-static member function.

Is this not possible to do, or is my syntax simply wrong? All I want is to be able to pass as an an argument to a method in the base class from the derived class some callback as a variable for the base class to invoke later.

View 2 Replies View Related







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