|
|
You are welcome. Anytime
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Here is a simple function which reads a text file line by line and fills a CStringArray:
void CSentenceAr::ReadTextFile(LPCTSTR pszFile)
{
m_strSentences.RemoveAll();
TRY
{
CStdioFile file(pszFile, CFile::modeRead);
CString strLine;
while(file.ReadString(strLine))
{
m_strSentences.Add(strLine);
}
}
CATCH(CFileException, e)
{
e->ReportError();
}
END_CATCH
}
NOTE: Once you can solve the problem using only MFC, it has no sense to mix STL (fstream) stuff.
However, when you do it, don't forget 'using namespace std', or write 'std::fstream'
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the solution
Jon
|
|
|
|
|
Hi,
I need someones help to Convert C++ strings to a C-style string (char*) in VC++ 6.0.
What I need to do is something as follows.
There is a string as,
string sh = “hello”;
I need to take the string in sh to
const char* tempd1 = .....
Thus I need someones help to do this.
Also if you can send me a way to convert a array of char(char st[]) to const char* .
Thanks
Dhananjaya
|
|
|
|
|
string s = "Hello";
const char *pCSTR = s.c_str();
Steve
|
|
|
|
|
Dhananjayak02 wrote: I need to take the string in sh to
std::string sh = "hello";
const char* tempd1 = sh.c_str();
or if u want the string to copy to another pointer
int n = sh.size();
char* c = new char[n + 1];
strcpy( c, sh.c_str());
Dhananjayak02 wrote: if you can send me a way to convert a array of char(char st[]) to const char*
char ch[20];
const char* pch = ch;
nave
|
|
|
|
|
Dhananjayak02 wrote: convert a array of char(char st[]) to const char* .
Before you try to *convert* types , you try to understand what are they.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
|
Dhananjayak02 wrote: a array of char(char st[]) to const char* .
they are almost same thing!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
QuickDeveloper wrote: is there any function in VC to get the current screen resolution
Either take the window rect of desktop window or use
GetSystemMetrics() funtion with the following parameters
SM_CXSCREEN - for width
SM_CYSCREEN - for height
QuickDeveloper wrote: change the bitmap accordingly??
StretchBlt() can help
nave
|
|
|
|
|
You can use for get width and height and also see this code maybe it is some helpful to you
int x=GetSystemMetrics(SM_CXSCREEN)for x
in y=GetSystemMetrics(SM_CYSCREEN)for y
<br />
Graphics graphics(GetDC()->m_hDC);<br />
CRect rect;<br />
ImageAttributes imAttrib;<br />
Image *img;<br />
GetWindowRect(rect);<br />
ScreenToClient(rect);<br />
img = Image::FromFile(A2W("D:\\0.bmp")) ;<br />
graphics.DrawImage(img,Rect(0,0,rect.right,rect.bottom),<br />
0,0,img ->GetWidth(),img ->GetHeight(),<br />
UnitPixel,&imAttrib);<br />
|
|
|
|
|
QuickDeveloper wrote: 2)is there any function in VC to get the current screen resolution and change the bitmap accordingly??
Otherwise the only alternative is to make the application work only under specific resolution
SystemParametersInfo and StrechBlt api will help
QuickDeveloper wrote: Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
good quote!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
hi
how can i hide a process?
|
|
|
|
|
farshad.f wrote: how can i hide a process?
hide from where?
nave
|
|
|
|
|
If it was easy to hide a process every virus/trojan would be doing it already.
Steve
|
|
|
|
|
1. By closing it.
2. By renaming it.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
VuNic wrote: 2. By renaming it.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
farshad.f wrote: how can i hide a process?
yes you can ShowWindow(SW_SHOW)... be more specfic while asking question?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
If anybody have used NetMeetin 3 SDK componant please reply. I need help on this.
Thank you.
KIRAN PINJARLA
|
|
|
|
|
kiran.pinjarla wrote: If anybody have used NetMeetin 3 SDK componant please reply. I need help on this
exactly what is your problem!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,i want to ask..how can v load the 3d images in opengl?
Regards
NooR
|
|
|
|
|
Read an OpenGL book - I think you need to get more familiar with the library if you are asking questions like this - do you mean render an image, load a 3D object from a file?
A cynic is a man who, when he smells flowers, looks around for a coffin. -H.L. Mencken
|
|
|
|
|
_I am using Visual Studio C++ .NET 2003, and I have problem when using cout. Here is my code:
#include <iostream>
using namespace std;
class A
{
private:
unsigned int m_nCount;
public:
A()
{
m_nCount = 0;
}
~A(){}
int Test()
{
m_nCount++;
return m_nCount;
}
};
void main()
{
A a;
cout << a.Test() << a.Test() << a.Test() << endl;
}
_ I expected that the output must be "123" but it was "321". I don't know what to do. Is my code wrong or that's a bug of VS C++ 2003. I need your help, thanks in anvance!!!
|
|
|
|