|
waldermort wrote: You will find that saving a gif file is very problematic due to the LZW compression and the patenting issues.
all of the relevant LZW patents expired years ago.
|
|
|
|
|
Oh, really? I didn't realize. So I'm guessing there are no reprocussions to loading and saving gif files now?
|
|
|
|
|
waldermort wrote: So I'm guessing there are no reprocussions to loading and saving gif files now?
that's right
|
|
|
|
|
I'm making a custom wizard to make a DLL project. I'm having a simple problem. I create 2 files, a header and a cpp file. In the project that the wizard creates, I want these files to end up in the Project's 'Source Files' folder. This isn't a physical directory on the disk, mind you. IOW, looking into the .vcproj file for the project, scanning down to the directory structure i'm finding this:
<br />
...<br />
< Filter<br />
Name="Source Files"<br />
Filter="txt"><br />
< /Filter><br />
< File<br />
RelativePath=".\PlugInImpl.h"><br />
< /File><br />
< File<br />
RelativePath=".\PlugInImpl.cpp"><br />
< /File><br />
...<br />
when what i want to see is this:
<br />
...<br />
< Filter<br />
Name="Source Files"<br />
Filter="txt"><br />
< File<br />
RelativePath=".\PlugInImpl.h"><br />
< /File><br />
< File<br />
RelativePath=".\PlugInImpl.cpp"><br />
< /File><br />
< /Filter><br />
...<br />
|
|
|
|
|
hmm the code snippet didn't come out like i wanted too there. well, you get my drift hopefully. i need the File elements to be nested in the Filter element. is this done through the javascript file in my custom project? if so, how?
|
|
|
|
|
Hi, I have a question about memory allocation for a CSafeArray, and in general.
Let's say I have a local variable defined like this:
void dosomething()
{
CSafeArray data;
data.CreateOneDim(1);
}
So now I've allocated memory for the CSafeArray. Does this mean I have to deallocate that memory once I'm done with it, or will this memory be automatically deallocated after the variable goes out of scope because it's locally defined? I always thought this would allocate heap memory and you'd have to manually deallocate but I just want to make sure.
Thanks!
Kelly Ryan
|
|
|
|
|
COleSafeArray's destructor takes care of that for you, so long as you haven't detached the SAFEARRAY object from it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Before now I used: h=open(....- command and seek/tell for positioning inside file
Now I use: hFile=CreateFile(..... command.
How to position inside file? Will seek/tell work ?
|
|
|
|
|
Monin D. wrote: How to position inside file? Will seek/tell work ?
No. fopen returns a FILE pointer. CreateFile returns a file HANDLE. Passing a HANDLE to any of the FILE operations will fail.
You can find a list of all the methods you can use with the file HANDLE you get from CreateFile here.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
Thank you very much, it helps me.
|
|
|
|
|
after use CreateFile that return hFile
you can declare CFile m_fFile(hFile) & then use
m_fFile.Seek....
if you wanna work with in text mode you should use CStdioFile instead
of CFile .
|
|
|
|
|
how seprate client area of application from frame window in MDI?
is way is correct sepreate CChildFrame ???
alternative way i hear is :
create window with WS_OVERLAPPED! but when
i try this:
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
cs.style |= WS_OVERLAPPED;<br />
if( !CMDIFrameWnd::PreCreateWindow(cs) )<br />
return FALSE;<br />
<br />
return TRUE;<br />
}<br />
there is nothing happen.
Best Regards.
MJM
|
|
|
|
|
mostafa_pasha wrote: seprate client area of application from frame window in MDI?
Please be more specific on what you want to do.
Best,
Jun
|
|
|
|
|
my project is MDI !
i have two view class , CStartPageView and CImageProcessingView !
first application execute OnDraw of CStartPageView because i create document
when OnFileNew fucntion run i create some object as CImagePorcessingView .when create new
page something that i use in CStartPageView::OnDraw show in client area of CImageProcessingView .
i mean every thing i draw in page has affect in another page!although the client area (to view class) is seperable.
<br />
m_pDocTemplate = new CMultiDocTemplate(<br />
IDR_ImageProcessingTYPE,<br />
RUNTIME_CLASS(CImageProcessingDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CImageProcessingView));<br />
if (!m_pDocTemplate)<br />
return FALSE;<br />
AddDocTemplate(m_pDocTemplate);<br />
<br />
m_pDocTemplateStartPage = new CMultiDocTemplate(<br />
IDR_ImageProcessingTYPE,<br />
RUNTIME_CLASS(CImageProcessingDoc),<br />
RUNTIME_CLASS(CChildFrame),<br />
RUNTIME_CLASS(CStartPageView));<br />
if (!m_pDocTemplateStartPage)<br />
return FALSE;<br />
AddDocTemplate(m_pDocTemplateStartPage);<br />
<br />
in OnFileNew:<br />
CDocument* pDoc = m_pDocTemplateStartPage->OpenDocumentFile(NULL);<br />
<br />
<br />
pDocTemplate->OpenDocument(BULL);<br />
<br />
|
|
|
|
|
mostafa_pasha wrote: in OnFileNew:
//create document that class view is CStartPageView
CDocument* pDoc = m_pDocTemplateStartPage->OpenDocumentFile(NULL);
// & for CImageProcessingView is
pDocTemplate->OpenDocument(BULL);
There are problems in your code. Try this in OnFileNew():
CImageProcessingDoc* pDoc = (CImageProcessingDoc*)m_pDocTemplate->OpenDocumentFile(NULL);
CFrameWnd* pNewFrame = m_pDocTemplateStartPage->CreateNewFrame(pDoc, NULL);
if (pNewFrame != NULL)
{
m_pDocTemplateStartPage->InitialUpdateFrame(pNewFrame, pDoc);
}
Best,
Jun
|
|
|
|
|
I am over-riding operator new [] so that when an array of "Objects" is created they contain information about adjacent items in the array. I am getting the following error....
c:\Visual Studio Projects\JLib\main.cpp(149): error C2661: 'Object<T>::operator new[]' : no overloaded function takes 3 arguments
The following code results in the above comilation error.
Object<double>* objects;
objects = new Object<double>[5]; // <- error occurrs here
delete [] objects;
If anyone knows what is going on I would very much appreciate an explanation.
Here is the relevant declarations and definitions...
#pragma once
#include <new>
using namespace std;
template <typename T> class Object{
public:
//CONSTRUCTORS ETC ETC ETC
void* operator new[](size_t size) throw(bad_alloc);
void* operator new[](size_t size,const nothrow_t&) throw();
void operator delete[](void* ptr) throw();
void operator delete[](void* ptr,const nothrow_t&) throw();
//OTHER STUF
};
template <typename T> void* Object<T>::operator new[](size_t size) throw(bad_alloc){
Object<T>* data = 0;
if ( (data = ::operator new[](size){
//ommitted for brevity
}
return data;
}
template <typename T> void* Object<T>::operator new[](size_t size,const nothrow_t&) throw(){
Object<T>* data = 0;
if ( (data = ::operator new[](size,const nothrow_t&)) ){
//ommitted for brevity
}
return data;
}
template <typename T> void Object<T>::operator delete[](void* ptr) throw(){
::operator delete [] (ptr);
ptr = 0;
}
template <typename T> void Object<T>::operator delete[](void* ptr,const nothrow_t&) throw(){
::operator delete [] (ptr,const nothrow_t&);
ptr = 0;
}
|
|
|
|
|
With GCC, the only error I get in your code is caused by the following (in bold):
template <typename T> class Object{
public:
void* operator new[](size_t size) throw(bad_alloc);
void* operator new[](size_t size,const nothrow_t& nt) throw();
void operator delete[](void* ptr) throw();
void operator delete[](void* ptr,const nothrow_t& nt) throw();
};
template <typename T> void* Object<T>::operator new[](size_t size) throw(bad_alloc){
Object<T>* data = 0;
if ( (data = ::operator new[](size){
}
return data;
}
template <typename T> void* Object<T>::operator new[](size_t size,const nothrow_t& nt) throw(){
Object<T>* data = 0;
if ( (data = ::operator new[](size, nt)) ){
}
return data;
}
template <typename T> void Object<T>::operator delete[](void* ptr) throw(){
::operator delete [] (ptr);
ptr = 0;
}
template <typename T> void Object<T>::operator delete[](void* ptr,const nothrow_t& nt) throw(){
::operator delete [] (ptr, nt);
ptr = 0;
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
I have problems reading values from a text file into an array. The first problem is reading the data from the file and the other is about data type conversion.
The values in a textfile are arranged vertically, like in a column:
0
1
0
1
1
0
0
1
.
. and so on. There is only 1 vertical column of numbers in the textfile.
I used a loop below to read the values from the file into an array:
while( inClientFile >> values) //inClientFile is an ifstream object.
cout<<.......<
|
|
|
|
|
See this response.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I'm having problems reading in line by line.
at the moment i have 2 and 3 in a text file sperated by a line. eg:
2
3
I am using the code below to read from the file...
<br />
while (PrimeFile.eof() == false && PrimeNumbers.size() < size){<br />
temp.clear();<br />
<br />
getline (PrimeFile,temp);<br />
<br />
tempInt = atoi(temp.c_str());<br />
<br />
<br />
<br />
PrimeNumbers.push_back(tempInt);<br />
<br />
<br />
}<br />
When the loop goes around once 2 goes into the int and is subsequently going into the vector PrimeNumbers. When it goes around again it reads 32 into the int.
Anyone know how i can get it so that it reads through the file one line at a time?
|
|
|
|
|
Since you are reading in numbers that are delimited by whitespace, you can use the following code:
while (PrimeFile.eof() == false && PrimeNumbers.size() < size)
{
int newPrimeNumber = 0;
PrimeFile >> newPrimeNumber;
PrimeNumbers.push_back(newPrimeNumber);
}
Alternatively, you can avoid writing your own loop altogether:
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
int main()
{
ifstream fin;
vector<int> MyVector;
fin.open("test.txt");
copy(istream_iterator<int>(fin), istream_iterator<int>(), back_inserter(MyVector));
fin.close();
copy(MyVector.begin(), MyVector.end(), ostream_iterator<int>(cout, " "));
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
I have some code which loads a char[] into memory from the source txt file,
Example
ifstream inn;
char text[20];
char text2[10];
inn.open("test.txt");
inn >> text; inn >> text2;
cout << text; cout << text2;
inn.close();
the text file contains
test and test
test
My problem is that this code only loads each word, seperated by a space in order. I want it to load it in order based on a new line.
Any ideas?,
thanks
Fred
|
|
|
|
|
FredrickNorge wrote: My problem is that this code only loads each word, seperated by a space in order. I want it to load it in order based on a new line.
The opeartor>> will stop when it gets to any whitespace. To get an entire line, use getline instead.
ifstream inn;
char text[20] = {0};
char text2[10] = {0};
inn.open("test.txt");
inn.getline(text, 19);
inn.getline(text2, 19);
cout << text; cout << text2;
inn.close();
Alternatively, you can use another version of getline that takes a string argument:
ifstream inn;
string text = "";
string text2 = "";
inn.open("test.txt");
getline(inn, text);
getline(inn, text2);
cout << text.c_str(); cout << text2.c_str();
inn.close();
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
thanks!, exactly what i needed.
Fred
|
|
|
|