Visual C++ :: Hex Values From Stream - Unicode Settings?

Feb 18, 2014

I am using VC++ 2005, Multibyte char set. I am getting hex values from stream and i have to show it in respective language.

in below example

char mt[] = { 0x0C, 0x85, 0x0C, 0x86, 0x0C, 0x87,0x0C, 0x88,0x0C, 0x89, 0x0C, 0x8A,0x0C, 0x8B,
0x0c, 0x85 , 0x0c , 0x86 , 0x0c , 0x87 , 0x0c , 0x88 , 0x0c , 0x89 , 0x0c , 0x8a , 0x0c , 0x8b , 0x00 , 0x20,
0x0c, 0x8e , 0x0c , 0x8f , 0x0c , 0x90 , 0x0c , 0x92 , 0x0c , 0x93 , 0x0c , 0x94 , 0x00 , 0x20 , 0x0c , 0x95,
0x0c, 0x96 , 0x0c , 0x97 , 0x0c , 0x98 , 0x0c , 0x99 , 0x00 , 0x20 , 0x0c , 0x9a , 0x0c , 0x9b , 0x0c , 0x9c,
0x0c, 0x9d , 0x0c , 0x9e , 0x00 , 0x20 , 0x0c , 0x9f , 0x0c , 0xa0 , 0x0c , 0xa1 , 0x0c , 0xa2 , 0x0c , 0xa3,
0x00, 0x20 , 0x0c , 0xa4 , 0x0c , 0xa5 , 0x0c , 0xa6 , 0x0c , 0xa7 , 0x0c , 0xa8 , 0x00 , 0x20 , 0x0c , 0xaa,
0x0c, 0xab , 0x0c , 0xac , 0x0c , 0xad , 0x0c , 0xae , 0x00 , 0x20 , 0x0c , 0xaf , 0x0c , 0xb0 , 0x0c , 0xb2,
0x0c, 0xb5 , 0x0c , 0xb6};

How can i convert the mt string to below string?

"ಅಆಇಈಉಊಋ ಎಏಐಒಓಔ ಕಖಗಘಙ ಚಛಜಝಞ ಟಠಡಢಣ ತಥದಧನ ಪಫಬಭಮ ಯರಲವಶ"

To cross check the mt array, If you place the above string to the below link you get mt array [URL] ....

Cant i do it in "Multibyte char set" settings? or should i use Unicode settings.

View 3 Replies


ADVERTISEMENT

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

Visual C++ :: File Stream Change Its Address During Writing Text Contents To The Stream

Apr 29, 2013

I wrote a program to write text contents to file stream through fputs, the file stream address was changed in the middle of writing text content to the stream (11% text content have been put into the file stream), that cause the file stream pointer can be evaluated problem and raise exception on stream validation code in fputs library function, my question is what things could go wrong to make file stream pointer changed its address to something else or a NULL pointer if the file stream have not been flushed and closed.

View 5 Replies View Related

Visual C++ :: Cannot Find The Property Settings File

Jul 31, 2013

Here the max sdk plugin is looking at X:projects rather than x:program files (x86)autodeskmaxsdk Inside the autodesk folder, there is a projectsettingspropertysheets subfolder where the plugin is looking for.

Now an error pops up saying it needs X:projectsprojectsettingspropertysheets....How can I fix that?

<Import Project="........ProjectSettingsPropertySheets3dsmax.general.project.settings.props" />

I find it hardcoded / How do I set where visual studio to search the correct property setting files automatically?

View 3 Replies View Related

Visual C++ :: Basic Settings - How To Configure Color Of Selected Text

May 4, 2014

How to configurate color of selected text. I am not sure why, but in Visual C++ it is not displayed as in other programs like notepad, which should be harder color. So I cannot find the selected text. Where can I configurate it or where to search it in desktop theme settings?

View 3 Replies View Related

C++ :: Unable To Extract Unsigned Values From Input Stream

Jan 16, 2015

I am trying to extract unsigned values from an input stream. I expect the extraction to fail when an invalid character is extracted. It fails correctly when I try to extract an unsigned int from "abc", but when I try to extract an unsigned in from "-1", the extraction succeeds, and the max unsigned int value is extracted (as if -1 were cast to unsigned int). I would expect the '-' to cause the extraction of an unsigned value to fail.

The code I am using is below.

#include <iostream>
#include <sstream>
#include <string>
#include <limits>
int main() {
unsigned int value = 8;
std::string negString = "-1";

[Code]...

Is this standard behavior for an istream extractor?

I am trying this in both Linux (gcc 4.4.3) and in windows with Code::Blocks (whaterver came with CB 13.12, apparently gcc 4.7.1)

View 11 Replies View Related

Visual C++ :: Whether 0xFFFF Is A Valid Unicode Character

Dec 22, 2013

I just wonder whether 0xFFFF is a valid Unicode character.

When I using the following code:

CStringW strTempW;
CString strTemp1;
INT_PTR nLen;
strTempW.Format(L"%c", 0xFFFF);
nLen = strTempW.GetLength();
strTemp1 += strTempW;
nLen = strTemp1.GetLength();

After executing the first codeline strTempW.Format(L"%c", 0xFFFF), I will get strTempW of length 1, but cannot see it first character in Visual Studio watch window.

After executing the codelilne strTemp1 += strTempW, I will get strTemp1 of length 0.

Whether 0xFFFF is taken as a valid Unicode or not?

View 1 Replies View Related

Visual C++ :: Saving Unicode Strings To Txt Files

Jan 20, 2014

In my project , we need to create an Array of Unicode Strings . The Array will contain 5000 Strings.

I need to write those strings to a text file which can be opened or edited with NotePad.

Normal _tfopen and fwrite are not able to create notepad compatible .txt file .. I mean the file I created is not readable with Notepad though file open mode is "w+t"

How can I save my unicode strings to a text file

View 6 Replies View Related

Visual C++ :: Convert Unicode (UTF-16) Functions To Ansi (UTF-8)

Nov 20, 2012

Working in Win32 console app (VS 2010) I have been trying to convert several Unicode (UTF-16) C++ functions to Ansi C (UTF-8). The test app includes two tokenizer classes, each of which work perfectly well in their respective environments, CTokA and CTokW (UTF-8 and UTF-16).

A problem arises when I attempt to run the UTF-8 functions when the Character Set properties is set to 'Use Unicode Character Set' in that std::string manipulations do not perform as expected, e.g.,

printf("start
");

gets reproduced as

printf("start
");══════════ ²²²²

Attempting to null terminate the string where it is supposed to end simply results in a space in that position and the garbage end persists, e.g.,

printf("sta t
");══════════ ²²²²

Code:
sline[11] = 0x0000;

If I attempt to change the Character Set property to 'Use Multibyte Character Set' or 'Not Set', the app will not compile and hundreds of errors occur. Of course, I can eliminate all of the UTF-16 code, but it strikes me that it should not be necessary. Perhaps if M$ made everything UTF-16 without all of the necessary decorations like 'L' and '_T(', life would be much simpler. Unfortunately, I have a very extensive UTF-8 app under 10 years of development that works quite well, but my UTF-16 (Unicode) conversion doesnt work as well because of the mixing of pointers (I think), so I have had to revert much of the code back to UTF-8. (All of which has nothing to do with my question but is simply psychotheraputic for me to ventilate on.)

My question is this: Can UTF-8 and UTF-16 code coexist in a single Win32 console app?

View 6 Replies View Related

Visual C++ :: Transferring Unicode String From One Program To Another With UTF-8 Encoding?

Mar 20, 2015

I'm transferring a unicode string from one program to another with UTF-8 encoding.

Program that is sending:

Code:
// Convert path
std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_converter;
CString arg = L" /PATH="" + CString(utf8_converter.to_bytes(path).c_str()) + L""";

Program that is retrieving:

Code:
// Restore original path
std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_converter;
std::wstring path = utf8_converter.from_bytes( argument );

Everything has worked fine, until running on a Japanese edition of Windows.

The "byte path" then looks something like "C:¥Users¥d✝?✝a ,?¥AppData¥Local¥Temp¥file.txt".

"from_bytes()" will throw an std::range_error exception "bad conversion".

The program works fine when working with Japenese writing inside paths in the English edition.

What could be causing the "bad conversion"?

View 10 Replies View Related

Visual C++ :: Get Data From Input Stream?

Jan 8, 2014

Code:
#include <fstream>
#include <string>
using namespace std;
ifstream inf("file name");
string line;
while (inf.good()) {
getline(inf, line);
}

instead of line by line i want the complete data from file to the string.What modification i have to do?

View 3 Replies View Related

Visual C++ :: Convert MM/DD/YY Hh:mm Stream To Integer?

Nov 7, 2012

I'm trying to read in two instances of date and time (from user input) into a string value (MM/DD/YY hh:mm).
I need to be able to calculate the difference between the two in order to return how much time has elapsed from the first date/time to the second date/time.

What would be the most efficient way to go about obtaining said results?

I was thinking I need to convert each year, month, day, hour, and minutes into its own integer variable, after researching immensely online I'm still not sure how to convert from a string of characters to an integer.

View 10 Replies View Related

Visual C++ :: Stream Data From System Windows Controls

Dec 19, 2012

I need make a CBitmap or a streamdata from a System.Windows.Controls::Image(rendered out put)in a SDI mfc application (supporting clr). Here is my codes:

Code:
using namespace System;
using namespace System::IO;
using namespace System::Collections::Generic;
using namespace System::Windows;
using namespace System::Windows::Controls;

[Code] .....

By this codes i can read datastream from bitmapSource but in this way somthing goes wrong in most of GIF animations. After debug i found out i need 3 more things too decode a gif animation - (x,y) position and size of each frame and disposal method for each one - finally i just found a way to draw tru images on a form window by this codes:

Code:
System::Windows::Window^ mainWindow;
mainWindow = gcnew System::Windows::Window();
mainWindow->Title = "GIF Imaging Sample";
//ScrollViewer^ mySV = gcnew ScrollViewer();
array<System::Byte>^ pixels = gcnew array<System::Byte>(bitmapSource->PixelHeight * Stride);

[Code] ...

When i change

Code: bitmapSource = decoder->Frames[0];
to
Code: bitmapSource = decoder->Frames[01];

frame[1] has drawn perfectly on window(i think some how Image class takes care about - (x,y) position and size of each frame and disposal method for each one ),so im wonder if how can i make a CBitmap or a data stream from System.Windows.Controls::Image class to use in mfc app.

View 2 Replies View Related

Visual C++ :: How To Convert UTF-8 String To Unicode String

Jun 15, 2013

I am using Visual Studio 2008. I just wonder if there are any library function in Windows SDK or MFC, or from third-parties, that can convert a UTF-8 string into Windows Unicode string(used in CString object).

Can MultiByteToWideChar or ATL String conversion macro like A2W to the conversion?

View 1 Replies View Related

C++ :: Reading Settings File

Aug 26, 2014

I'm trying to make a basic settings text file and I'm wondering why pos_y = strAxisData.find(",", pos_x, strAxisData.length()); returns std::string::npos when pos_y = strAxisData.find(","); works fine ? The settings text file format is:

string strAxisData;
while(finConfig)
{
getline(finConfig, strAxisData);
pos_x = strAxisData.find("=");
if(pos_x != std::string::npos)
}

[code]....

View 1 Replies View Related

C++ :: Singleton Class For User Settings?

Oct 11, 2014

My current idea of how to work with user settings goes like this:

1. Create a class to hold all of the user settings.
2. Use that class to load/save/hold settings in memory.
3. Create an instance of that class once in the entry point of the program (int Main or whatever).
4. Pass, by reference this same class instance around to all of the other classes that need the user settings.
5. Once all other objects deleted, save and then delete the User Settings class.

I created a psuedo-code example below of this. My question is if this is the best way or should I be doing something else. In particular, I am wondering if somehow I can avoid passing the settings class by reference all of the time. Would this be a good case scenario for a "Singleton" type class?

#include <string>
class UserSettings {
private:
std::string SettingOne;
int SettingTwo;
bool SettingThree:

[Code] ....

View 9 Replies View Related

C++ :: Configure Netbeans Basic Settings

Nov 22, 2013

I want to configure netbeans 7.4 settings for c++.I'm posting here because netbeans forums are close to dead. How to do the following things :-

1) When you create a new project of a 'new application' type, main.cpp is already there with some code. I want that main.cpp to be completely empty when I create a new project.

2) When you compile/build your program and run it, the output is shown in a small log window at the bottom. I want it to be shown like in a black output terminal (console ?) just like in Visual Studio or CodeBlocks. (I have some reasons for not using them instead, so don't bother about me not using them)

3) When you click the green 'Run' icon in the upper toolbar, the project is compiled/build again and then runs afterwards. I want it to just run without compiling. (Compiling/Building should be done by 'Build' icon, just like in CodeBlocks or Visual Studio)

View 3 Replies View Related

C/C++ :: What Settings Has To Be Made To Run Language In Jgrasp

Nov 25, 2012

Running c in jgrasp.. i am getting error has gcc not found.

View 4 Replies View Related

C Sharp :: How To Create Manual Printer Settings

Jan 19, 2014

My professor assign me a task to create a manual printer settings, not necessary same as printer setting the important thing to do is to have a combobox. In the combobox that you will see the available installed printers, and one command for print that if going to select one available printer in the combobox. It is possible ?

View 1 Replies View Related

C# :: Change Settings In User Config Of Different Applications Directly

Jan 10, 2014

I have a service that has some settings. As the service is running as a system user, the settings file is located in

C:Windowssystem32configsystemprofileAppDataLocal<PRODUCTNAME><ExecutableName+GUID><VERSION>user.config

Now i want to be able to change some settings at runtime using a normal Winforms App. Is there a good and easy way to change the user.config of a different application directly? I tried with ConfigurationManager but that does not seem to work.

View 8 Replies View Related

C Sharp :: How To Shrink Size Of Word Documents By Changing Format Settings

Jul 31, 2012

I've created a solution who exported Access reports (graphics/tables) to a Word- and a PDF-format. Therefor I use PDFSharp and PDFFocus.

The PDF document is okay. But the Word-document looks good. Only the size of the Word-document, it has to send by e-mail, is much too big (17MB).

I have to open the Word document again to change the PageSettings to be sure, that the page-margins and the print orientation are correct.

using System;
using Microsoft.Office.Interop.Word;  
namespace PageSetup {
    class TestPageOrientation {
        static void Main(string[] args)

[Code] .....

I don't know how it works in the Word-library source. But I've tried WdOrientation.wdOrientPortrait and once I was surprised. I saw this page in Landscape-format.

I think there is something wrong with my document sections, because the documents (with a lot of tables, graphics and a image) is much too big. And that's only after using this method.

So my next question is: How can I shrink the size of this Word document?

And what do I have to do to limit the amount of format-settings in this word-document?

View 1 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++ :: Unicode And Win32 API Functions

Aug 11, 2014

You told me that it's better to use UNICODE all the time.

What if the Win32 Api function doesn't have a UNICODE version.

For example CryptProtectData() takes a BYTE (DATA_BLOB *) which is an unsigned char?

[Code] ......

View 7 Replies View Related

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++ :: Is UNICODE Enabled By Default In VC++ Express

Feb 25, 2014

For example if using FindFirstFile(...) it assumes your passing LCPWSTR and not LPCSTR.

I know I can use FindFirstFileA or FindFirstFileW so what is point of default if always UNICODE.

Which brings to my second question. If I say

FindFirstFile("C:", &fdat);

I get error cannot convert parameter 1 from 'const char [7]' to 'LPCWSTR'

I could say WCHAR fName = "C:"; and pass this variable instead. However is there a way to cast "C:" on-the-fly to LPCWSTR, I tried,

FindFirstFile((LCPWSTR)"C:", &fdat);

But it outputs a stream of LONGs to the console instead of filenames.

View 5 Replies View Related







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