|
The text file fp pointing to contains:
"Hello world, (space) (space) (space) What is up??".
|
|
|
|
|
C_Zealot wrote: while((ch_read = fgetc(fp)) != 32) {
Your outer loop needs to read until EOF, not a space, is reached.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thank you. I will try it.
|
|
|
|
|
Hi all. Im having trouble with a DNS client. I spent a great deal of time trying to figure out a few little things and now its not even doing what i want.
My code:
<br />
#include <iostream><br />
#include <winsock2.h><br />
using namespace std;<br />
<br />
main(){<br />
const int SIZE=100;<br />
char msg[SIZE];<br />
WORD wVersionRequested;<br />
WSADATA wsa;<br />
struct hostent *host;<br />
printf("Please enter the Host name to look up.\n");<br />
cin.getline(msg, SIZE);<br />
printf("Doing a DNS lookup of '%s'\n",msg);<br />
wVersionRequested=MAKEWORD(2, 0);<br />
WSAStartup(wVersionRequested, &wsa);<br />
host=gethostbyname(msg);<br />
if((host = gethostbyname(msg)) == NULL)<br />
{<br />
printf("DNS Lookup of '%s' failed!\n",msg);<br />
}<br />
else<br />
{<br />
printf("DNS Results are: '%s'\n",host);<br />
}<br />
WSACleanup();<br />
system("pause");<br />
return 0;<br />
}<br />
Took me a half a hour to figure out how to initialize wVersionRequested. Now it compiles with a charm. however it doesnt do a DNS lookup. In fact its only printing out useless information. Whats am i missing? Thanx in advance!
|
|
|
|
|
You can't printf a hostent* like that
Maybe something like this (non-Unicode code):
if((host = gethostbyname(msg)) == NULL)
{
printf("DNS Lookup of '%s' failed!\n",msg);
}
else
{
if (host->h_addrtype == AF_INET)
{
in_addr inaddr = *(in_addr *)(host->h_addr_list[0]);
char *pAddStr = ::inet_ntoa(inaddr);
if (pAddStr)
{
printf("DNS Results are: '%s'\n", pAddStr);
}
}
}
Mark
-- modified at 19:16 Monday 30th April, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanx Mark Salsbery it worked fine. I'll be looking into getaddrinfo() later. I hear its a lot more simpler.
|
|
|
|
|
You're welcome! getaddrinfo() is nice, especially with gethostbyname() being deprecated.
getaddrinfo() is marked as XP and above though, which is why I removed it from my post.
I'm not sure why I did...it made sense yesterday
Have fun,
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I'm sure this has been asked a billion times already but on a quick search I couldn't find the answer.
I'm having some issues with getting MsFlexgrid to work on VC++ v 7.1.3088 using .NET Framework 1.1 SP1. When I try to insert the microsoft FlexGrid version 6.0 it says it could not be instantiated because it needs a design-time license. I'm not sure I understand why this is coming up. I registered the control, but apparently it needs more.
Any help is appreciated.
Thanks!
|
|
|
|
|
can image processing application b developed with the inbuilt libraries???i mean without using CIMG or other this kind ov libraries???
if anybody has done it...can they gimme the code of how to read and process an image???im doing a project in image processing,the project is conversion of monochrome film to colored!
can v read a video im VC++?how to go abt it???
waitin for a prompt reply...my deadline is round the corner...
thanx...
Evil Bluez
|
|
|
|
|
|
1. sumbody just replied that i shud use openCV...but shud i use tht even if just wanna read an image pixel by pixel and do the following work on it???
2. lemme giv u this one in detail
a. im gonna read frames from a film.
b. quantize them so that im left with lesser gray scale values
c. then develop my own colormap
d. apply this colormap
e. frames back to movie
3. yes i need the frames..now how can i do that???
Evil Bluez
|
|
|
|
|
So which your movie format ? mpeg ? wmv? . In that case you case use
direct show filter graphs. Then you will get the yuv / RGB frames as a byte array. So you can do whatever you need. Then for saving this frames you need to again encode it to the original format. Hope this helps. If you don't know directshow search in google , you can find many tutorials.
if you movie is an uncomprssed file (like raw avi)you can just use videoinfoheader structure and parse the file.you will get each frames.
hoeps this helps
If u can Dream... U can do it
|
|
|
|
|
Dear friend
Try to download OPenCV and use it with your project.
go to intel site and download OpenCV library.
It contains all the information which you want to show a video or picture.
You can use it in Visual C++.
|
|
|
|
|
Hello all,
I suppose that is time to go to sleep, I need to convert a BSTR to a CString and I've seen that if the project is UNICODE I can do something like:
BSTR b;
CString a = "";
a = b;
The problem is that due to the need of using a old ActiveX that did not supported unicode I deselected it in the wizard at the beggining.
Now I'm not using that OCX control and I'd like to be able to reactivate the UNICODE, but I've not been able to see any difference between two empty projects (one with unicode and the other one without).
As always thank you in advance...
|
|
|
|
|
The difference is, when _UNICODE is defined, all the generic text mappings are interpreted as wide
characters (wchar_t) where, without _UNICODE defined, they are mapped to single byte characters
(char).
This affects CString as well because CString is actually a generic version of the CStringT
template class.
Your sample code works for both Unicode and non Unicode builds (in VS2003+ at least) because
CString has an assignment operator overload which takes a const wchar_t *.
For non unicode builds, the assignment operator calls ::WideCharToMultiByte() to convert the
BSTR to a char string.
Remember CString is generic - it's internal character type is based on your Unicode setting.
You can always force the type by using the non-generic CStringA and CStringW types.
You can test it out something like this (examine the compiled types of each string object):
CString a = "generic";
CStringA b = "ANSI";
CStringW c = "WIDE";
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
In VC6, go to your preprocessor defines, remove the _MBCS symbol and add UNICODE and _UNICODE , then rebuild all. In later versions, there's a setting in the C++ section that controls the character set - change that to Unicode.
|
|
|
|
|
I got something weird weeks ago ..
Try this .. create a windows application in C++ (use Visual
Studio 2003 ( or .Net how they call it but NOT Visual Studio 2005)
open the resource view .. add a dialog .. add 253 buttons and SAVE
the project ..
.. so far no issue ..
.. now add button 254 .. and ..
.....POW .. Devstudio has to close due to unexpected error ..
"..you want to send an error report ? .." it asks
.. BUT ..
If you go into projectname.rc by righ-clicking on the .rc file -> open with
-> text editor .. you can add as many controls as you like .. open resource
editor later and reposition them as required ..
Anybody knows what patch to install to fix this .. because I get really
tired maintaining corporate apps that way .. can't port to 2005 either
because it's not our standard .. VS2005 by the way I tested with 1024 in one
screen items so far with no issues ..
C mments .. anybody ..
|
|
|
|
|
You must be in a very far country from Spain because I still see the sun... (wow! that display must be very big...).
Just kidding, sorry I've not been able to resist...
|
|
|
|
|
hro_external wrote: add button 254
hro_external wrote: tested with 1024 in one
screen items so far with no issues ..
|
|
|
|
|
I designed a SoftPhone and i need to interface a USB phone device to it.
I was able to use HidD_ and HidP_ functions to interface with the phone
buttons(HID device) but i can not interface to LCD display of the device.
Any one has an idea how to do that?
Is there a GUID for the LCD display part of the USB _Phone_Device?
Is there a group of functions for LCD_Display interface?
Thank you
Spyros Panaoussis
e-mail: SpyFxp@yahoo.com
|
|
|
|
|
Hello,
I have recently started using automation for excel wherein I have opened an excel worksheet and reading the cells from the sheets.
But how do I find out How many rows are there in a particular worksheet if suppose I will have equal no of rows in a worksheet.
Is there any documentation or link which can guide about the functions in _Application,Worksheets Worksheet class ?
Prithaa
|
|
|
|
|
prithaa wrote: But how do I find out How many rows are there in a particular worksheet...
With Excel 2003, there are 65536 rows (and 256 columns).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
Thanks for your reply.
I wanted to know how many rows are filled in, in a particular column.As if I want the no of records in excel typed in.
Is there any function which can tell that.
Are there any links for automation classes _Application,Worksheets
prithaa
|
|
|
|
|
Hello...
I have two dialogs. In each of those two dialogs I've placed several CStatic and several CEdit. In the first dialog I have only one button. and in the second dialog I have two buttons.
I've noticed that on checkboxes and on buttons seems that I can press the up or down cursor keys and the focus moves automatically to the next/previous window depending on the key.
In the first dialog this is true, but in the second one I once the focus has entered into one button it cannot go out from it by pressing the up or down keys...
Anyone can tell me were can I find information related to teh cursor keys and buttons? or could anyone tell me what is happening here?
As always thank you in advance.
|
|
|
|
|
Do you have the WS_TABSTOP and WS_GROUP styles in place correctly?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|