|
It's a VS2008 project - is that OK?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Am I doing anything wrong in setting the properties of the tab control.
Shall I send the sample code.
|
|
|
|
|
It seems like you're doing everything....
Send me an email from here and I'll reply with the project.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am waiting for ur reply
|
|
|
|
|
It works now when i call insert item
Thanks
|
|
|
|
|
Ohhh you had no tabs
I guess the email through CodeProject isn't working yet....I sent one
so I could get your address to send the project.
Glad you got it working!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
You're welcome!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I forgot how to read from a text file, line by line, help!
|
|
|
|
|
CStdioFile::ReadString
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
Thanks Johpoke it worked, and thanks to the other guys too for their responses.
|
|
|
|
|
i have a file which contains hex values. i want to convert that to human readable form. please give me some leads.
|
|
|
|
|
try itoa function for more help LOOK MSDN
|
|
|
|
|
Chandrasekharanp wrote: i have a file which contains hex values. i want to convert that to human readable form. please give me some leads
hex format is human readable. Do you mean a binary file (as opposite to text one)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
ya right... i am sorry for the wrong query.. i need to read it from a file and convert that to ascii and then print it to another file.
|
|
|
|
|
Oh,that's not difficult, for instance:
Supposing ANSI build and error handling left to the reader
FILE * fpin = fopen("MyBinaryFile.foo","rb");
FILE * fpout = fopen("MytextFile.txt","w");
int c;
int count = 0;
while ( (c=getc(fpin)) != EOF )
{
fprintf(fpout, "%02x ", c);
if (count % 16 == 15) fprintf(fpout, "\n");
count++;
}
fclose(fpin);
fclose(fpout);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
Chandrasekharanp wrote: thanks GURU!!!!!!
Oh, I'm not.
Anyway, you're welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hello,
I have one structure contains char * variable. I want to store the CString data to char* variable.
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
I have one CString variable like m_Username. I want to store m_Username to char *_base.
Could you please help me how to do.
|
|
|
|
|
_base = m_userName.GetBuffer
or
_base = new char[]
strcpy(_base, m_userName.getbuffer)
|
|
|
|
|
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
typedef struct _iobuf FILE;
FILE *fleCredentials;
fleCredentials = fopen("credentials.crd", "a+");
fprintf(fleCredentials, "%s ",(LPCTSTR)m_Username );
Problem:
========
Only one character of "m_Username" has to be stored in the "credentials.crd". I would like to store the fullname into the file.
Help to proceed further.
|
|
|
|
|
Sunil Shindekar wrote: _base = m_userName.GetBuffer
The above is a mistake, because, unless you want to lock the CString internal buffer forever, then you have to call ReleaseBuffer method, afterwards the _base pointer becomes garbage, please read documentation http://msdn2.microsoft.com/en-us/library/kt26tkzx(VS.71).aspx[^].
Sunil Shindekar wrote: _base = new char[]
strcpy(_base, m_userName.getbuffer)
Better, but still mistakes. You don't need at all GetBuffer , to do this (and you aren't calling ReleaseBuffer afterwards), the LPCTSTR cast operator is enough.
Furthermore you don't specify character array size.
And, finally, you're supposing that it is an ANSI build.
Is It enough?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Provided it is an ANSI (not UNICODE build, you can
do:
CString strFoo("foo");
struct _iobuf iobuf;
iobuf._ptr = new[strFoo.GetLenght()+1];
if (iobuf._ptr)
{
strcpy(iobuf._ptr, strFoo);
}
...
...
if (iobuf._ptr)
{
delete [] iobuf._ptr;
}
However, I suggest, if you can, to refactor a bit you project (i.e. avoiding such a mixing of string classes and character arrays.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|