Visual C++ :: How To Convert IP To Hex

Sep 27, 2012

I don`t known how to convert IP to hex .

In this link [URL] .... . I see hex IP : Hex IP 0x462a1779

I want to convert IP "70.42.23.121" to "0x462a1779"

Code:
#include <winsock.h>
#include <windows.h>
#include <stdio.h>
UINT32 ip_to_hex(UINT32 ip_add) {
UINT32 ip_hex;
//code convert ip to hex
return ip_hex;

[Code[ ....

And this is result : 7b 1e 80 and a , not 0a

Further i think we must separate each octect by a (dot) . , Then convert decimal to hex.

View 6 Replies


ADVERTISEMENT

Visual C++ :: Convert HSB Color To RGB And RGB To HSB?

Jun 11, 2014

I am trying to make this code working and to remake it to work also for RGB to HSB? This code is for C and I need to make it working in Visual Studio C++ .

Code:
// mask1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
typedef struct RGB_t { unsigned char red, green, blue; } RGB;
typedef struct HSB_t { float hue, saturation, brightness; } HSB;

[code]....

Error I got is error C3861: 'fmaxf': identifier not found

What file or namespace should I include. Do I need to add some library into linker?

View 14 Replies View Related

Visual C++ :: How To Convert DLL Project To MFC Extension

Oct 5, 2012

If I drop this regular dll project and create a new MFC extension dll project, it will involve too much work. I wonder if there is relatively easier way to convert an existing regular dll project to a MFC extension dll project? BTW, how can I tell a MFC extension dll project from a regular dll project?

View 1 Replies View Related

Visual C++ :: Convert Money To Denominations?

Sep 26, 2013

Problem:Given any amount of money expressed in dollars, and cents, this program computes the number of 100 , 50, 20, 10, 5 and 1 dollar bills and number of quarters, dimes, nickels, and pennies to be returned, returning how many of each denomination are included.

I figured out how to program it correctly for the most part except I cannot figure out how to handle large numbers, such as 14.49999999999999999999999999999999.When converting that number to int it returns it as 14.50. How to handle converting doubles, similar to the one above, to an integer correctly?

This is the code that my teacher did not want, since I handled the input as a string:

Code:
#include <iostream>
#include <string>
#include<iomanip>
#include<windows.h>
using namespace std;
int main(){
const int hundredsConst=10000, fiftiesConst=5000, twentiesConst=2000, tensConst=1000;

[code].....

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++ :: Convert C# Module Into Unmanaged DLL?

Oct 21, 2014

I am in need to convert some C# code into C++ equivalences. But I don't want to spend the efforts to do so. Is there an handy way to convert an existing code of C# into C++ (unmanaged code)?

View 7 Replies View Related

Visual C++ :: How To Convert MFC Dependent Source To Non-MFC

Feb 25, 2013

IDE = Visual Studio 2008 Express

I am a novice programmer(still...) , and I am trying to build the Code Project project located at this address:

[URL] .....

The project page is titled " Remote Control PCs ".

I would like to use this program plus I wanted to practice programming using the code base. However, I don't have MFC so I thought I would just convert it to non-MFC.

For example, It seems to me that any class inherited from MFC would need to be reimplemented. I think I also need to reimplement any code that uses "stdafx.h"

I built a custom project out of the zlib library and compiled it as a Windows library with the /MT settings. Both 32 and 64 bit library files, in Release and Debug mode, are included. The ZLIB.H and ZCONF.H files are also included. For examples of single-threaded usage, see the CZLib class. For examples of multi-threaded usage, see the classes CDriveMultiThreadedCompression, CMultiThreadedCompression, and CZLib.

1)How should I go about compiling this zlib custom project?

2)Where does the /MT option go ?

3)How do I use the output ( zlib.lib - I guess)?

View 9 Replies View Related

Visual C++ :: How To Convert PNG Image Into Byte Array

Mar 12, 2013

I m loading a png image by using the ATLImage library.

CImage Image;
Image.Load (L"D:ImagesPNG_ImagesImage7.png");

how to retrieve the byte array value of this png image. I tried retrieving it as

byte *png = reinterpret_cast<BYTE *>(Image.GetBits());

but when i access the data , der is a loss of data while converting it in the above manner.

I found a snippet in net for decoding the raw data . but der is a line is the code which is unknown to me. The code is as follows :

CImage atlImage;
HMODULE hMod = GetModuleHandle(NULL);
atlImage.Load(bstr);
void* pPixel = atlImage.GetBits();
intpitch = atlImage.GetPitch();
intdepth = atlImage.GetBPP();

[Code] ....

How do I get the byte * value form the png image loaded?

View 3 Replies View Related

Visual C++ :: Convert XML Attributes To Class Using Tinyxml

May 8, 2013

i am trying to create a firework display by reading in the fireworks off a .xml file, which will then iterate through and launch each firework.

I followed a tutorial on dinomage to find out how to use tinyxml, i learnt that i can store the attributes into char pointers but i dont know how to convert them to GLfloats to store them in my class variables.

I did try using atof but when i ran the program i got loads of errors which im guessing is because the pointer only stores the address which im passing to my variable.

Update

i have found out that tinyxml is not compatible with vs2010 but tinyxml 2 is, so i have changed my code but am still having trouble loading my attributes i have added error checking, and it prints out that the xml has loaded but then it wont load the root

updated code

my code: Firework.h

Code:
#ifndef FIREWORK_H
#define FIREWORK_H
#include <cstdlib>
#include <GLGL.h>
#include <string>

[Code].....

View 14 Replies View Related

Visual C++ :: Convert 8 Bytes Into Double And Back?

Sep 5, 2013

I receive a byte stream. The first 8 bytes contain an Identification number. I receive at first the lowest byte and at the end the highest byte of the number. How can I transform this into a double value and later back into the bytestream? In the past I hard only 2 Byte values and there I could use things like MAKEWORD and HIBYTE and LOWBYTE to convert the values

View 4 Replies View Related

Visual C++ :: How To Convert Time Into CTime Format In MFC

Jun 13, 2013

I have total time in seconds (say 2500 seconds). I want to store this time in CTime or CTimeSpan format.?

How to do this.?

View 2 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++ :: Initializing Auto Variables - Cannot Convert Parameter

Sep 8, 2014

I am new to VC++ 2012. I have this code snippet.

Code:
auto it = query_map.find(U("callback"));

The problem is right under the dot there is a red line the error is

Error1error C2664: 'std::_Tree_iterator<_Mytree> std::_Tree<_Traits>::find(const http::uri::encoded_string &)' : cannot convert parameter 1 from 'const wchar_t [9]' to 'const http::uri::encoded_string &'d:maverickprojectsstrikeforcesrcserverserverserver.cpp26

What is the solution to this error?

View 3 Replies View Related

Visual C++ :: Convert String Of Uppercase Letters Into Its Corresponding Lowercase

Apr 26, 2014

Write A Program which converts a string of uppercase letters into its corresponding lowercase.Using pointers to access the members of the Array.

Write A program that reads eight float numbers into an array and then print out the second,fourth,sixth and eight members of the array,

And Sum of the first,third,fifth,and seventh. Using pointers to access the members of the array.

View 2 Replies View Related

Visual C++ :: Convert BITMAPINFO Header Into Unsigned Char Pointer?

Jan 10, 2014

I have a bitmap header information in the struct

typedef struct tagBITMAPINFO {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO

The total size of this is 1080.

Now i want to convert this into a unsigned char pointer.

unsigned char * pBMPHeaderData;

I already got the raw image data in another unsigned char buffer.

unsigned char* pRawBMPData;

Now i want to make a complete BMP image by adding the header info and raw data into a new unsigned char pointer. For this i need to convert the BITMAPINFO struct into a unsigned char *

So the new buffer will be,

unsigned char * pCompleteBMPIMageData = pBMPHeaderData + pRawBMPData;

how to do this?

View 3 Replies View Related

Visual C++ :: Convert Floating Point Bilinear Image Resampling Routine?

Feb 19, 2013

In short I'm converting a floating point bilinear image resampling routine into one that only uses fixed point arithmetic. I've gotten rid of nearly all the floats now, in fact all but one and the results at the moment are in distinguishable from the floating point version. It's a maths issue really. Some pseudocode goes like this.

Code:
for( int xx=0; xx<ow; xx++ ) {
int_center = (ccx >> 16);
int temp = xx * 2;
for (j = int_center; j <= int_center + 1; j++)

[Code] ....

Where ccx is and integer error accumulator that gives me a scaled integer. Shifting down buy 16 gives me the relative pixel I need to be working on. The line just after where the inner loop begins is where I have the last remaining float. FILTER_FACTOR is essentially a percentage by which I scale the error accumulator to the correct amount.

For example.

ccx = 98303. Which is a value of 1.5 when shited down by 16 bits. Obviously I can shift it because it will round and I lose the precision. Lets say FILTER_FACTOR is 39321. Which is 60% of 1 (65535) So what I'd like to know is, is it possible to use the FILTER_FACTOR as an integer and do some fancy integer math to scale the result from (ccx - (j<<16)) by the representative amount that is FILTER_FACTOR. In this example 60%. Effectively getting 40% of (ccx - (j<<16)) At the moment FILTER_FACTOR is still a float and therefore 0.6, which of course works just fine.

View 4 Replies View Related

C++ :: Class Template Convert Which Can Convert Itself To Any Data Type

Sep 23, 2012

Code:
template<class T>
class Convert {
T data;
public:
Convert(const T& tData = T()) : data(tData)

[Code] ....

Why do we use operator? Is float and double function names below?

Code:
Convert<int>::operator<float> float();
Convert<int>::operator<double> double();

View 1 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 :: How To Convert PPM Into JPG

Nov 17, 2013

I captured .ppm from avi file. How can I convert .ppm into .jpg only using C.

View 3 Replies View Related

C++ :: Can't Convert To Hex

Mar 30, 2014

I was assigned a problem involving using buffer overflow to access a different function than I was supposed to. I was able to figure out how to modify the point in stack that I need to change using a printf statement, however what doesn't make sense is that when I use the input "AABBCCDDEEFFGGx86x64x00x00" the stack changes to 78363878 I looked up the ascii codes and I assume that it's not converting x86, but using the input x86 instead.

View 4 Replies View Related

C++ :: Can't Convert Char To Int

Nov 9, 2013

I am writing a basic keylogger and i want to add data to log file, but it says that i cant convert char to int. Everything else works fine.

Code:
#include <iostream>#include <windows.h>
#include <stdio.h>
#include <time.h>
using namespace std;

[Code] ....

View 3 Replies View Related

C :: How To Convert Char To Int

Nov 24, 2014

Example

char A[4]
gets(A) --> 1234

View 11 Replies View Related

C :: Convert DAT File Into TXT

May 19, 2014

I have written this to convert this .dat file into .txt file but it is not working well. It create one .txt file and also with content but contain some garbage content also .

Code:

#include <stdio.h>
#include <stdlib.h>
void fileInput(cfPtr);
void convertText(cfptr);
int menu();
}

[code]....

View 1 Replies View Related

C++ :: Convert Hex To ASCII

May 7, 2013

I want to convert Hex:390041 to ascii "90A",

39: 9
00: 0 -->Null
41: A

i am getting only "9" in the bytearray,i know 0 is terminating the array

unsigned int bytes[3];
int j=0,counter=0;
char c[2];

[Code]....

View 1 Replies View Related

C++ :: Convert A Value Into A String?

May 21, 2013

I would like to convert a value into a string, and extract a value from a string. And then call these functions in the main.

template<class T>
string toString (T value) // convert a value into a string {
stringstream ss;

[Code[ .....

Are above functions correct? And how should I call in main?

int main() {
const int SIZE=10;
toString<int> intValue(SIZE); //seems not right
toString<double> doubleValue(SIZE); // seems not right
}

View 3 Replies View Related

C++ :: How To Convert Int To Char

Jan 24, 2015

if we have int x = 5; and we want to convert x which is == 5 to char so for example char number = x doesnot work i understand why , but how to convert it ?

View 14 Replies View Related







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