|
I'm guessing the crash occurs because MoveWindow is called on the list view after it is destroyed.
Try putting an IsWindow check over the MoveWindow.
if (IsWindow(m_hwndListView))
{
MoveWindow(m_hwndListView,
0,
0,
rect.right,
rect.bottom,
true);
}
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks very much for your reply.
IsWindow() did not help.
Crash occurs only under following condition:
Child window containing tree control is opened and kept in non-maximized state
Then, child window containing the list is maximized and then this closed.
Anything else that you could think of?
|
|
|
|
|
You could try to use MoveWindow only when the wParam parameter of WM_SIZE is SIZE_RESTORED.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
That also does not help
|
|
|
|
|
Thanks for your time and help superman.
Tried IsZoomed(hWnd) to do some conditional operation when closing in maximized state, but that also did not help.
Problem was that an allocated object was being deleted in WM_CLOSE . When this was moved to WM_DESTROY the crash is solved. Still not sure why this was causing the crash only when in maximized state!! Will look into this at a later time.
|
|
|
|
|
Sir,
Can u help me to improve this code .I want to create small project in c++,java.Give me some tips .Will it appropriate to use java to write this type of code?
Code:
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include <time.h>
void coupd();
void coup();
void gen();
void dlx();
void spd();
class room
{
protected:
int r_no;
int r_charge;
char r_cust[20];
char c_city[20];
int c_mem;
char c_nat[20];
char r_avail;
int r_per;
int no;
char type[20];
int charge;
char cust[20];
char avail;
int per;
int year;
int mon;
int day;
public:
char r_type[20];
char getavail()
{
return(r_avail);
}
void getr1()
{
r_no=1;
strcpy(r_type,"spd");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr2()
{
r_no=2;
strcpy(r_type,"dlx");
r_charge=1000;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr3()
{
r_no=3;
strcpy(r_type,"gen");
r_charge=750;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr4()
{
r_no=4;
strcpy(r_type,"coup");
r_charge=1250;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr5()
{
r_no=5;
strcpy(r_type,"coupd");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void putinfo()
{
cout<<"\n"<<r_no<<"\t "<<r_type<<"\t"<<r_charge<<"\t "<<r_avail<<"\t "<<r_cust<<"\t "<<r_per;
}
void modify()
{
cout<<"\n Enter modifyied data";
cout<<"\n____________________________________________________________________________";
cout<<"\n Enter Room no :";
cin>>no;
cout<<"\n Enter Room type :";
cin>>type;
cout<<"\n Enter Room charges :";
cin>>charge;
cout<<"\n Enter Room Availability :";
cin>>avail;
cout<<"\n Enter name of cust living :";
cin>>cust;
cout<<"\n For how many days cust want the room :";
cin>>per;
cout<<"\n...... Data is modified";
r_no=no;
strcpy(r_type,type);
r_charge=charge;
r_avail=avail;
strcpy(r_cust,cust);
r_per=per;
}
void allocate()
{
if(r_avail=='Y')
{
cout<<"\n Enter Name of cust living :";
cin >>cust;
cout<<"\n For how many days cust want the room :";
cin>>per;
cout<<"\n Enter city name :";
cin>>c_city;
cout<<"\n Enter nationality :";
cin>>c_nat;
cout<<"\n Enter no. of member in your group :";
cin>>c_mem;
cout<<"\n Enter the date of arrival ";
cout<<"\n------------------------------";
cout<<"\n Year : ";
cin >>year;
cout<<"\n Month :";
cin >>mon;
cout<<"\n Day :";
cin >>day;
cout<<"\n... Room is allocated to "<<cust<<" for "<<per<<" days.";
strcpy(r_cust,cust);
r_per=per;
r_avail='N';
}
else
{
cout<<"\n ERROR : Room cannot be allocated ...";
cout<<"\n Room is not available...";
}
}
void putcust()
{
int i,j;
i=day+r_per;
j=strcmp(r_cust,"N.A");
if(j==0)
{
cout<<"\n Data not available ";
}
else
{
cout<<"\n Room No :"<<r_no;
cout<<"\n Customer Name :"<<r_cust;
cout<<"\n Days :"<<r_per;
cout<<"\n City :"<<c_city;
cout<<"\n Nationality :"<<c_nat;
cout<<"\n No of member :"<<c_mem;
cout<<"\n Arrival Date :"<<day<<"/"<<mon<<"/"<<year;
date(i,mon,year);
}
}
friend void date(int d,int m,int y);
};
void date(int d,int m,int y)
{
int i;
i=m%12;
if(i==0)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==1)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==2)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==3)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==4)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==5)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==6)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==7)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==8)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==9)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==10)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
else
if(i==11)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d<<"/"<<m<<"/"<<y;
}
}
class bill: public room
{
private:
long total;
int food;
long room;
float ser;
int t;
int oc;
public:
void calculate()
{
room= r_charge * r_per;
cout<<"\n Enter the bill amount of restaurant:";
cin>>food;
cout<<"\n Enter other charges:";
cin>>oc;
t=(int) room + food + oc;
ser=(int)(0.05*t);
total=t+ser;
}
void dispbill()
{
clrscr();
cout<<"\n________________________________________________________________________________";
cout<<"\n************************* Super Star Hotel ***********************";
cout<<"\n -------------------------------- ";
cout<<"\n S.V.Road,Dahisar(E),Mumbai-92. ";
cout<<"\n Tel :- 4545454 ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Customer name : "<<r_cust;
cout<<"\n ";
cout<<"\n Stayed for "<<r_per<<" days";
cout<<"\n Room charges : "<<r_charge<<"(Per day)";
cout<<"\n Room charges : "<<room<<"(total)";
cout<<"\n Restaurant bill : "<<food;
cout<<"\n Other charges : "<<oc;
cout<<"\n Ser.tax % = 5%";
cout<<"\n Ser.tax ="<<ser;
cout<<"\n Bill Amount >>>>>> Rs "<<total;
cout<<"\n ";
cout<<"\n THANK YOU !!!!!";
cout<<"\n Do Visit Us Again !";
strcpy(r_cust,"N.A");
r_per=0;
r_avail='Y';
day=0;
mon=0;
year=0;
strcpy(c_city,"N.A ");
strcpy(c_nat,"N.A ");
c_mem = 0;
}
void check();
};
void bill:: check()
{
if(r_avail=='Y')
{
cout<<"\n"<<r_no<<"\t "<<r_type<<"\t"<<r_charge<<"\t "<<r_avail<<"\t "<<r_cust<<"\t "<<r_per;
}
}
void main()
{
int i,ch;
bill R[5];
char c;
clrscr();
R[0].getr1();
R[1].getr2();
R[2].getr3();
R[3].getr4();
R[4].getr5();
textcolor(4+200);
textbackground(1);
time_t t;
clrscr();
t = time(NULL);
cout<<"\n "<<ctime(&t);
t -= 24L*60L*60L;
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n*************************** WELCOME TO HOTEL SUPER STAR ************************";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n--------------------------------------------------------------------------------";
getch();
textcolor(10);
textbackground(4200);
xyz:
clrscr();
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n********************** Super Star Hotel **************************";
cout<<"\n ________________________________ ";
cout<<"\n S.V.Road,Dahisar(E),Mumbai-68. ";
cout<<"\n Tel-45454545. ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n ";
cout<<"\n 1.GET INFORMATION 2.GET CUSTOMER INFO ";
cout<<"\n ";
cout<<"\n 3.MODIFY INFORMATION 4.CHECK THE AVAILABILITY ";
cout<<"\n ";
cout<<"\n 5.ALLOCATE ROOM 6.FEATURES OF ROOMS ";
cout<<"\n ";
cout<<"\n 7.CREATE BILL 8.EXIT ";
cout<<"\n\n Enter your choice : ";
cin >>ch;
if(ch>8)
{
clrscr();
cout<<"\n Wrong choice ....";
getch();
goto xyz;
}
if(ch==1)
{
clrscr();
cout<<"\n ROOM INFO ";
cout<<"\n ----------- ";
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period |";
for(i=0;i<=4;i++)
{
R[i].putinfo();
}
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}
else
if(ch==2)
{
abc:
clrscr();
int n;
cout<<"\n Enter room no. :";
cin>>n;
if(n>5)
{
cout<<"\n Wrong choice ....";
getch();
goto abc;
}
n=n-1;
clrscr();
cout<<"\n CUSTOMER INFO ";
cout<<"\n -------------- ";
R[n].putcust();
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}
else
if(ch==3)
{
pqr:
clrscr();
int a;
cout<<"\n Enter Room no :";
cin>>a;
if(a>5)
{
cout<<"\n Wrong choice ...";
getch();
goto pqr;
}
a=a-1;
R[a].modify();
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}
else
if(ch==4)
{
clrscr();
cout<<"\n AVAILABLE ROOMS ";
cout<<"\n ----------------- ";
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period|";
for(i=0;i<=4;i++)
{
R[i].check();
}
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}
else
if(ch==5)
{
int b;
def:
clrscr();
cout<<"\n Enter room no to be allocated:";
cin >>b;
if(b>5)
{
cout<<"\n Wrong choice ...";
getch();
goto def;
}
b=b-1;
R[b].allocate();
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}
else
if(ch==6)
{
ghi:
clrscr();
int a,d,e,f,g,h;
char c;
char b[5];
cout<<"\n Enter Room No:";
cin>>a;
if(a>5)
{
cout<<"\n Wrong choice ...";
getch();
goto ghi;
}
a=a-1;
strcpy(b,R[a].r_type);
d=strcmp(b,"spd");
e=strcmp(b,"dlx");
f=strcmp(b,"gen");
g=strcmp(b,"coupd");
h=strcmp(b,"coup");
if(d==0)
{
spd();
}
else
if(e==0)
{
dlx();
}
else
if(f==0)
{
gen();
}
else
if(g==0)
{
coupd();
}
else
if(h==0)
{
coup();
}
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
}
else
if(ch==7)
{
stu:
clrscr();
int b;
cout<<"\n Enter Room no :";
cin>>b;
if(b>5)
{
cout<<"\n Wrong choice ...";
getch();
goto stu;
}
{
char av;
av=R[b-1].getavail();
if(av=='Y')
{
cout<<"\n ERROR: Room is not allocated.";
cout<<"\n Bill cannot be created ";
getch();
goto stu;
}
else
{
R[b-1].calculate();
R[b-1].dispbill();
getch();
}
}
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
}
else
if(ch==8)
{
goto mno;
}
mno:
}
void spd()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n Room Type >>> Sp.delux ";
cout<<"\n\n Room charges >>> Rs.1500 per day";
cout<<"\n\n 1. Bed >>> 2";
cout<<"\n\n 2.Capacity >>> 5";
cout<<"\n\n 3.Balcony available ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n ADDITIONAL FEATURES ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n 1.A/C available ";
cout<<"\n\n 2.Geyser available";
cout<<"\n\n 3.TV available ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
}
void dlx()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM ";
cout<<"\n-------------------------------------------------------------------";
cout<<"\n\n Room Type >>> Delux ";
cout<<"\n\n Room charges >>>Rs.1000 per day";
cout<<"\n\n 1. Bed >>> 2";
cout<<"\n\n 2.Capacity >>> 5";
cout<<"\n-------------------------------------------------------------------";
cout<<"\n ADDITIONAL FEATURES ";
cout<<"\n-------------------------------------------------------------------";
cout<<"\n\n 1.A/C avaalable ";
cout<<"\n\n 3.Geyser available";
cout<<"\n\n 4.TV available ";
cout<<"\n-------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
}
void gen()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n Room Type >>> General ";
cout<<"\n\n Room charges >>>Rs.750 per day";
cout<<"\n\n 1. Bed >>> 2";
cout<<"\n\n 2.Capacity >>> 5";
cout<<"\n------------------------------------------------------------------";
cout<<"\n ADDITIONAL FEATURES ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n 1.Geyser available";
cout<<"\n------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
}
void coup()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n Room Type >>> Couple ";
cout<<"\n\n Room charges >>>Rs.1250 per day";
cout<<"\n\n 1. Bed >>> 1";
cout<<"\n\n 2. Capacity >>> 2";
cout<<"\n\n 3.Balcony available ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n ADDITIONAL FEATURES ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n 2.Geyser available";
cout<<"\n\n 3.TV available ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
}
void coupd()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n Room Type >>> Couple delux ";
cout<<"\n\n Room charges >>> Rs.1500 per day";
cout<<"\n\n 1. Bed >>> 1";
cout<<"\n\n 2.Capacity >>> 2";
cout<<"\n\n 3.Balcony available ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n ADDITIONAL FEATURES ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n\n 1.A/C available ";
cout<<"\n\n 2.Geyser available";
cout<<"\n\n 3.TV available ";
cout<<"\n------------------------------------------------------------------";
cout<<"\n NOTE :- Extra bed will cost Rs.50 per bed ";
}
|
|
|
|
|
CSawant wrote: Can u help me to improve this code .
Yes, but why? Read here first and then modify your post.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Please review the posting guidelines (1st or 2nd post at the top of the list).
This signature was proudly tested on animals.
|
|
|
|
|
Okay first, I have an executable the loads several DLLs. One of these DLLs needs to create a window and set an openGL context. A second DLL, which gets placed in its own thread executes functions on the first DLL. The initial problem I had was that the window was being created upon loading of the first DLL, and when the second DLL called functions on it from it's own thread, the openGL context would not be valid. I fixed this by making sure the window was created by the second DLLs worker thread that calls all of its functions.
So now, I can verify that all of my openGL calls are not failing, the problem though is that nothing is happening in the window itself. Right after the window is created it appears to hang. The cursor changes over it and it is no longer selectable. I can verify that the windows message proc is being called correctly and it does get to WM_CREATE. I can also verify that the program itself is not hanging as the calls are still being made.
The only thing I can think of as the problem is that when the window is created it is launching it's own additional thread, and I am subsequently trying to make my GL calls within the wrong thread. First, does this sound like the problem, and if it is, is there a way to make the window launch within the same thread that created it? I have made sure that the HINSTANCE that is passed into CreateWindowEx is that of the DLL.
I hope this makes sense as it is a little long winded. Any help is appreciated.
Thanks,
Dustin
|
|
|
|
|
How to create and maintain HTML file?
Many applications use HTML as their log file. Many application output data to HTML too.
I also hope to use HTML file as my application's log file. I hope to use it to provide more information to uses by HTML file.
So I have to create HTML file for log file. I have to read old HTML file and update information in the HTML file too.
Is there one HTML library that can make it easy to write and read HTML file? Can it make it easy to parse the information in HTML file?
|
|
|
|
|
I'd recommend to use XML files for logging. There are tons of libraries to modify XML files. You can then use XSL to convert it into a HTML file. If you link the XML file to the XSL file then loading the XML file with a browser automatically shows the desired HTML page. I learned everything form www.w3schools.com/[^].
Kind regards
Marcus
|
|
|
|
|
Hi there,
I would like to write a program that converts a small text file into a picture file, probably a .jpg. I would also like the optio of adding smaller .jpg files to the larger .jpg file containg the text.
I just need to know the best way of doing this in C/C++/MFC. I need this to work in a windows environment though Linux compatability would be an added bonus.
When this project is complete I will add it to code project as my first post.
Thanks for looking!
Tony
|
|
|
|
|
1scouser wrote: I would like to write a program that converts a small text file into a picture file
Can you explain this a little better ? what is the input text ?
anyway, a non-portable solution :
You can use CDC::TextOut or CDC::DrawText to draw to a device context.
After that, you can use CBitmap::CreateCompatibleBitmap to create a bitmap from the device context; and after that, use CImage (from GDI+) to "export" the bitmap object to jpg or bitmap, or whatever format CImage supports.
This signature was proudly tested on animals.
|
|
|
|
|
I just need a program that opens small .txt files created with notepad and also small .jpg pictures. The program then needs to combine the text and pictures into one larger picture file probably a .jpg.
Thanks again!
|
|
|
|
|
1scouser wrote: The program then needs to combine the text and pictures into one larger picture file probably a .jpg.
Yeah but out of context that doesn't mean anything... What are you trying to do exactly ? Sould the text be written on the picture ? If yes, where, and how, and with which font, ...
Do you realize that your question doesn't make a lot of sense ?
You have to explain what you mean by combining text and picture.
|
|
|
|
|
Sorry if my original question was a bit vague. It's been quite a while since I've done any C/C++/MFC programming, in fact VC6. I just need to be pointed in the right direction.
Let me rephrase my question. I have been thinking that instead of converting .txt files and .jpg files into a larger .jpg file, it would be easier if I could convert a single .htm file (obviously containg text and .jpg) into a single .jpg file. Where do I start and what do I need to consider, is this much more difficult than I thought?
Regards
Tony
|
|
|
|
|
It might be more difficult than you thought or perhaps you are not quite sure of what you are trying to do. If you are going to combine a text file with a jpg you will first need to be able to read your text file and your jpg.
I suggest you use google or the CodeProject search facility to find out how to read jpgs (reading a text file should be trivial) and display them.
From there you need to decide what you want to do with your text - put it over the picture like a watermark? Place it above or below like a title? Do you need to be able to move the text around the screen to place it? Are different fonts required? What facilities do you want to be able to add, move, change font/colour/size? Menus, toolbars?
When you have thought about all this and how it might go together then you need to think more about what you then want to do save it as a jpg? Other formats allowed? Save As?
Let us know how you get on - if you have any (more specific) questions I'm sure you'll be helped here by someone!
|
|
|
|
|
You could download Imagemagick, that has all the things you asked for (and much much more), compatible with linux also... It has a simple commandline interface that can be called from yoyr program...
see: http://www.imagemagick.org/Usage/[^]
Rozis...
|
|
|
|
|
hi all,
i have declared a character pointer like this:
char *cHeaderInfo = new char[dwSize + 28 + dwSize1 ];
but while deleting it i am getting assertion failed on this line:
if(cHeaderInfo)
{
delete []cHeaderInfo;
cHeaderInfo=0;
}
it is working fine in 90% cases but failing sometimes, but i am not sure why...so please help me out of this.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
What does the assertion say?
You're probably storing something in cHeaderInfo that is bigger than dwSize + 28 + dwSize1.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
thanx alot superman,
i increase its size and its working fine now......it is what we say a great answer....
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
You should consider using the safe string functions like _tcscpy_s and other C runtime functions that end with _s. Or you must use safe string APIs like StringCchCopy.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Keep in mind that you may have simply masked the problem rather than actually solved it. Find the code that writes to that variable to make sure it is indeed big enough.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I suspect you've forgotten to add "+1" for the null terminator - looking at your code, it looks like you've added the maximum sizes of constituent strings, but not the '0' at the end.
I would suggest you think about using a string class (std::string or CString) rather than char arrays wherever possible - that way you don't need to worry about managing memory like this.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
here it is the C code , it prints the base filename
I want to modify it to print the following
/work1/data/xxxx/yyy/
const char * path = "/work1/data/xxxx/yyy/file_name.txt";
const char * filename; filename = path+strlen(path);
while (filename != path && *(filename) != '/')
filename--;
if ( filename != path)
filename++;
cout << filename;
|
|
|
|