|
One last thing. I was able to create the file larger than 4 Gb. However, I want to be able to read the last line to see where it stopped. This code outputs the whole file but works when the file is less than 4Gb. What's wrong?
If you want me to start another thread let me know.
Thanks,
ifstream inClientFile ("diction.txt", ios::in);
inClientFile.seekg(-10, ios::end);
char w[7];
while (inClientFile>>w)
output(w);
void output(const char * const w)
{
cout<
|
|
|
|
|
Andrew Admire wrote:
If you want me to start another thread let me know.
hum, yes, i think you'd better, till i can't help you there...
tell me anyway, you create a char[7], but do all the words in your dictionnary are smaller than or equal to 6 characters (don't forget the trailing '\0') ?!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Originally I had it set to 30. Even then it only worked when the file it was reading was less than 4Gb.
|
|
|
|
|
Hello! I'm meaning to write a simple app in Visual C++, though I'd like to give it a different "skin" than the standard Windows apps. Is there some sort of (free, preferably ) lib out there that enables you to create custom looks for buttons/menus/scrollbars so I can focus on the simple app?
Any help would be.. helpful
/Vanne
|
|
|
|
|
|
You can try AppFace User Interface Development Kits . Download it here, http://www.appface.com
|
|
|
|
|
i'm developing an application to interface some board with pc using usb port. i've to develop upload, download data and disconnect feature. can i hgot some application code in vc++ how to link it with existing windows driver and write application code
vikas makhija
|
|
|
|
|
There is not a standard way to communicate with any USB device. If manufacturer doesn't give you the frames' format specification, or an API, I guess you won't do it.
If you want to learn about USB programming, I suggest you to buy the book "USB Complete" by J.Axelson
Jaime
|
|
|
|
|
I want to a send file from my PC to the PC in my university through sockets. How do i get the unique ip for my pc connected to internet via LAN. The packet does not the reach the destination(ip of the pc connected to LAN), probably it is discarded for some security purpose. I want to understand the reasoning of the problem & the solution. Please help me
Regards
|
|
|
|
|
Are you natted? This way it is not possible to reach your PC. You are behind firewalls and NATting devices, that only have a selected amount of public addresses and a significant amount of internal IP addresses. Sockets dont have much to do with it.. IP rather.
"live life one cpu cycle at a time".
|
|
|
|
|
then whats the solution ... can u please suggest an alternate ????
|
|
|
|
|
You have to open ports on the firewall, or ask your netadmin to open ports on the firewall. But, if impossible (and probably wont be done as well) - you have to write a program that sits on a host that listens and is accessible over the internet. Either your machine at home, or an alternative, third party machine.
Easiest would be if you could open your machine at home..
"live life one cpu cycle at a time".
|
|
|
|
|
You Quote
"you have to write a program that sits on a host that listens and is accessible over the internet. Either your machine at home, or an alternative, third party machine."
I did not get what u have explained. Sir, can u plz explain me. Do you my one more application needs to run on the server in university. Please explain me the whole scenario.
I shall be very gr8ful to u.
Regards,
Ibraheem
|
|
|
|
|
If the server is accessible over the Internet, then it is possible, or if port forwarding is enabled. It needs to be accessed over the Internet via public addresses.
The terms -server- and -client- can mix up, since as soon as you listen() on a socket, that will accept() connections on your client, then your client becomes the server.
The whole scenario would be like the following:
You have a program running at home, on your computer that dials into the ISP. Your PC at home has a public IP address, such as 72.9.248.26, ... Your PC in the university is most probably NAT'ed and firewalled. You will have an internal IP address (RFC1918) such as 10.0.0.1.
From home you cannot reach your univ pc, if you type in "ping 10.0.0.1" it wont get far. From the university however, if you type "ping 72.9.248.26", it will respond (if firewall rules allow). So, to connect to a machine, since you cannot reach your university machine, you have to connect to your home computer, from the university.
Makes a little sense?
Take care,
Michael
--
code.ae
|
|
|
|
|
Hi all,
This is roland working for s/w comp in pune as trainee programmer in SDK (win 32)as i don't have preiveious experience in sdk i am getting some problem.....so can anybody help me....my project is related to desktop & printing ...when user selects a perticular area on desktop or on screen he should get only that area after printing ..
i am getting the selected image on screen but after taking print for it the colors of that image are not appear as they are on screen i am getting very light colors image....i tried lots for this but i didn't get it...i got one API ColorMatchToTarget But where should it place or is it really work for this ???so can anybody help me & guiide me plz???
thks waiting for reply.......
roland
|
|
|
|
|
How can I solve the probelm with the following error message:
"variable" already defined in GO.obj
|
|
|
|
|
This means that you defined "variable" in more than a file, and both defines it as public
If each one should have its copy, try putting static in front of them
If the variable should be shared, declare it as extern in one of the files
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I have added extern to the variables with the error message and
the problem is solved. Thanks!
But i only declare them in one file. Why does the problem occur?
my project name is go and i declare the variables in go.h just below #define... (as global)
|
|
|
|
|
Anonymous wrote:
But i only declare them in one file.
But that .h file is included in multiple places.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Can you show how and where are you doing the declaration?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Its ok now. I know the problem. Thank you very much!
in go.h:
// GO.h : main header file for the GO application
//
#if !defined(AFX_GO_H__76EC2730_7BFA_4A29_9F6A_226E7AEC7B81__INCLUDED_)
#define AFX_GO_H__76EC2730_7BFA_4A29_9F6A_226E7AEC7B81__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#define MAX_STEP 1000
#define MAX_FILE_NAME 30
#define BOARD_SIZE 19
#define BLACK '@'
#define WHITE 'O'
#define KEP '*'
#define EMPTY '.'
#define EMPTY_STAR '+'
#define CHECKED_LAND 'C'
#define BLACK_LAND 'b'
#define WHITE_LAND 'w'
#define SHARED_LAND ' '
struct step_record
{
char command;
int row;
int col;
};
// global variables:
static char boardc[BOARD_SIZE][BOARD_SIZE];
static char turn;
static int kep_row, kep_col;
static int black_eaten, white_eaten;
static int step_num, last_step_num;
static bool remove_dead_chess;
static bool count;
static float black_land, white_land;
static struct step_record step[MAX_STEP+1];
/////////////////////////////////////////////////////////////////////////////
// CGOApp:
// See GO.cpp for the implementation of this class
//
class CGOApp : public CWinApp
{
public:
...
|
|
|
|
|
Anonymous wrote:
// global variables:
static char boardc[BOARD_SIZE][BOARD_SIZE];
static char turn;
static int kep_row, kep_col;
static int black_eaten, white_eaten;
static int step_num, last_step_num;
static bool remove_dead_chess;
static bool count;
static float black_land, white_land;
static struct step_record step[MAX_STEP+1];
This is wrong!
I believe that you want one variable that is shared among all the components of your application. The current situation is that each object file (component) has its own copy of the variable. So if you execute the following statement in GoApp.cpp:turn = (char)100 the change is only seen in GoApp.cpp, so in GoView.cpp, the variable turn is still undefined!
Try the following instead:
<br />
char boardc[BOARD_SIZE][BOARD_SIZE];<br />
char turn;<br />
extern int kep_row, kep_col;<br />
extern int black_eaten, white_eaten;<br />
extern int step_num, last_step_num;<br />
extern bool remove_dead_chess;<br />
extern bool count;<br />
extern float black_land, white_land;<br />
extern struct step_record step[MAX_STEP+1];<br />
<br />
extern char boardc[BOARD_SIZE][BOARD_SIZE];<br />
extern char turn;<br />
int kep_row, kep_col;<br />
int black_eaten, white_eaten;<br />
int step_num, last_step_num;<br />
bool remove_dead_chess;<br />
bool count;<br />
float black_land, white_land;<br />
struct step_record step[MAX_STEP+1];<br />
This way, the value of the variables is the always the same in every component..
Blog[^]
|
|
|
|
|
I'm trying to edit subitem of a CListCtrl object. Here's what I do:
void CMyDialog::OnBeginLabelEditMyListCtrl(NMHDR* pNMHDR, LRESULT *pResult)
{
// based on current mouse position, find out which item and
// iSubItem are being clicked by using m_myListCtrl.SubItemHitTest(&ht)
// get the rect of the licked sub item by
// m_myListCtrl.getSubItemRect(ht.iItem, ht.iSubItem, LVIR_LABEL, subRect);
// try to put my variable CEdit m_edit at this location
CEdit *plistEdit = m_myListCtrl.GetEditControl();
if ( plistEdit )
{
m_edit.SubClassWindow(plistEdit->m_hWnd); <--- ERROR here
}
// coding to set *pResult
}
when running, the error message is:
Error: Trying to use SubclassWindow with incorrect CWnd
derived class.
hWnd = $608D8 (nIDC=$0000) is not a CEdit.
how come? both plistEdit and m_edit are of CEdit, why this error?
Thanks for any help!
|
|
|
|
|
ok, got it.
I declared m_edit in my header file, and called
m_edit.Create() in the initialization routine.
I shouldn't. that's how I got the assertion failure.
|
|
|
|
|
What is the value of m_edit::m_hWnd before the call to m_edit.SubclassWindow()? m_edit is not allowed to have an window already attached to it before calling SubclassWindow.
Look up CWnd::SubclassWindow in MSDN for more information.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|