|
Your variable time1 is a pointer only. There are no bytes that it points to that you can then fill up with the sprintf call. Off the top of my head that is probably the same thing with variable t.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
-- modified at 14:55 Monday 19th December, 2005
|
|
|
|
|
for time1 :
iiscodered wrote: char *time1;
sprintf(time1,"%d:%d:%d",t->wHour,t->wMinute,t->wSecond);
this is not correct.
you have to allocate the memory space to then be able to write there (with the sprintf() call...).
for example, add this :
<font color=blue>char</font>* time1 = <font color=blue>new char</font>[10];
<font color=green>
<font color=blue>delete</font>[] time1;
for t :
first of all, choose variable names that denote clearly what it is supposed to do !!! t is not an explicit name.
iiscodered wrote: LPSYSTEMTIME t;
GetLocalTime(t);
same this again here.
t is not allocated...
it seems to me that you are new to C++, aren't you ?
moreover, the compiler might have told you a clear enough message of what was going wrong in you code... read them with interrest, ,compiler is your friend !
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
you should use 'new' .
i.e: char *time = new char(10);
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
|
robbers put the stolen words first before the actual comes out.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
hey i really didn't look at the replies, i read the qurey, and just clicked on 'reply'. then i found another idle guy has already replied for that.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
Just declare the 't' string to have soem data space available.
Do
char time1[32];
instead of
char *time1;
and it will be fine.
No shirt, no shoes, no brains, no service.
|
|
|
|
|
Hi,
Since I can't put the initialization of a static data member in the class definition, how can I assign the value of lets's say a document data member to an object's static data member ?
Thx.
|
|
|
|
|
You have to do it in the cpp file
class foo
{
static int x;
int doFoo();
};
int foo::x = 12;
int foo::doFoo()
{
...
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Is static data member accesible
only accessible by scope resolution operator .
say
by "this" pointer .(or pointer to class)
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
that doesn't mean its accesible only by a "::", but since its accessed directly through a class we need to use ::. its not accessed thru an object.(.) if u do so by an object, it creates new values everytime new objects get instantiated but here ::, its static (same)for all.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
When I draw to a dialog window using dc.SetPixel, everything looks great... until another window is moved over the dialog. All graphics are erased. How can I prevent this?
|
|
|
|
|
you have to do all your drawing in response to a WM_PAINT message, or in MFC-talk, in your window/dialog's OnPaint member. that function is called when your window needs to be repainted, and if you're painting anywhere outside that funciton, your stuff will be overwritten the next time the default drawing stuff gets called.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks. That works pretty good. But I must be doing something else wrong. Below is a snip from a simple dialog program to draw a box when a button is pushed. I put the drawing stuff in the OnPaint. Although it does redraw the box most of the time, when I drag another window over the box slowly, sometimes I get lines where the box was not totally redrawn.
void CBoxDlg::OnPaint()
{
int x, y;
CPaintDC dc(this); // device context for painting
if (IsIconic())
{
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
if (draw_rectangle == TRUE)
{
for(x=0;x<100;x++)
{
for(y=0;y<100;y++)
{
dc.SetPixel(x,y,RGB(240,0,0));
}
}
}
}
}
void CBoxDlg::OnDrawButton()
{
draw_rectangle = TRUE;
RedrawWindow();
}
|
|
|
|
|
i need an example of open dialog box with Source Control button (meaning... open dialog box that allows to open regular files on a client computer and also allows to open files from Source Control (like sourcesafe)).
|
|
|
|
|
Hi,
i m working on a Project , to make backup on tape drive . i m having problem while writting the last DBLK on the tape and don't know how to find its help on net . do any of you GURU's plz refer any help avaiable on net for this problem.....
Thanks ....
"I only fail when i give up "
|
|
|
|
|
Hello.
What's the problem?
If you want to know how to mark the end of a data file on tape, the normal way is to write a Tape Mark.
The rule is:
End Of File: A Tape Mark
End Of data on Tape: Two consecutive Tape Marks.
Is that your problem?
Kakan
|
|
|
|
|
hi,
thanks for your reply ..
what i m doing is
i m writing Dblks in the following order , i have also check that windows backup utility makes backup in such way on tape drive ,
On PBA: 1
Tape Header
------------
On PBA: 2
Tape Mark
------------
On PBA: 3
SSET
Volb
Dirb
File
Espb
------------
On PBA: 4
Tape Mark
------------
On PBA: 5
ESET
------------
On PBA: 6
TFDD
------------
On PBA: 7
TSMP
------------
On PBA: 8
ESET
-----------
On PBA: 9
Tape Mark
-----------
After writting in this way i m checking with MTFCheck utility , which shows that there is problem from the ESET DBLK , ( PBA 5 )
=======================================================================
ESET Dblk:
[WARNING] Possible wastage of space: 15360 bytes.
[ERROR] Checksum failed in current stream header.
[ERROR] Valid ESET not found.
[ERROR] DBLK must be aligned with the FormatLogicaAddress boundary .
[ERROR] ESET was expected here.
[ERROR] Valid ESET not found.
ESPB was expected here.
[ERROR] Couldn't read data for valid ESET.
=================================================================
waiting for your reply
"I only fail when i give up "
|
|
|
|
|
Hello.
OK, I get your problem.
But I'm sorry to say I can't help you. I thougt you were using raw tape writes, and had a problem with that.
I've created code to handle all major file systems on magnetic tape, but I haven't used Windows backup tape library.
Again, I'm sorry.
Kakan
|
|
|
|
|
thanks for your reply...
may you plz refer me how to get solution of this problem on net . i have tried few other forums and not able to find any help for this...
thanks again ....
"I only fail when i give up "
|
|
|
|
|
|
hi,
yah , i have seen this , after making backup from NTBackup utility on tape drive , i can successfully restore the data , but i m facing problem in writing on tape drive , and writting according to MTF is really getting hectic for me ... plz reply...
"I only fail when i give up "
|
|
|
|
|
if listbox shows the path of a jpeg file, how can i open this jpeg file form a 32x32pixels picture on the front of row?
which lib should i use?
|
|
|
|
|
|
library GDI+
class Graphics
class Bitmap
see in MSDN
|
|
|
|