|
a CString is not a buffer of char's, and you can't treat it like one.
if you want to use CString, you should use the MFC file classes (ex. CStdioFile).
|
|
|
|
|
Thanks a lots for your lighting me up. I have a MFC program
interface. That is why I have to use CString. Also I am not
too familar with MFC. So could you teach me more on the code
with CStdioFile. I am using:
f_ptr6 = fopen(dogfile1,"r");
to use the array of file names.
Thanks again!
-- modified at 12:15 Monday 24th September, 2007
|
|
|
|
|
here is a sample that reads all lines in a file: http://simplesamples.info/Beginners/CStdioFile.php
|
|
|
|
|
"CString is not a buffer of char's, and you can't treat it like one."
I am sure this is not a good correct statement.
|
|
|
|
|
on the contrary, it is both correct and good.
|
|
|
|
|
Aside from a misplaced apostrophe, how is it any worse than, "...a good correct statement?"
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Actually, the code compiles and run. Yes, I did not copy correctly, here is:
CString ftitle[100];
for (i=0;i
|
|
|
|
|
mrby123 wrote: Actually, the code compiles and run.
Which is no guarantee that it is correct.
Use my suggestion and you'll find that it works correctly.
mrby123 wrote: Yes, I did not copy correctly, here is:
And how is this any better? Do the for() loops not look odd?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It is something odd, when I copied the loop is looked good. However,
after I posted, it changed to odd looking and lost some bits.
my for loop was OK.
The code looks like this now after your guys help:
for (i=0;i
|
|
|
|
|
mrby123 wrote: It is something odd...
There's nothing odd about it. You are clicking the Post Message button instead of the Preview button.
mrby123 wrote: for (i=0;i {
After three times now, can you not see anything wrong with your code snippet?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
And your code actually compiles?
Very strange for loop.
Unless you did not copy your entire code snippet correctly I cannot see an index i increment
|
|
|
|
|
Did you even bother to preview your post before submitting it? Does it not look strange to you at all?
mrby123 wrote: fscanf( f_ptr3,"%s\n", ftitle[i]);
Try:
fscanf(f_ptr3, "%s\n", ftitle[i].GetBuffer(MAX_PATH));
ftitle[i].ReleaseBuffer();
Why use FILE* and fscanf() with MFC when CStdioFile is available.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Firstly, Thanks for your help. Your code works for me. I am not familar with MFC. I guess MAX_PATH is a system built variabler ? So I do not need to define it.
Why use FILE* and fscanf() with MFC when CStdioFile is available - I am hybrid my old c++ code of some meth calculations with MFC interface, so I get into these troubles.
Thanks a lots from your guys for lighting me up.
|
|
|
|
|
mrby123 wrote: I guess MAX_PATH is a system built variabler ? So I do not need to define it.
Correct. It's defined in windef.h .
mrby123 wrote: I am hybrid my old c++ code...
Perhaps you meant old C code. Same here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi i have create an activex. how to open it in browser ie internet explorer. im newbie to this activex. pls help me
|
|
|
|
|
You need to use the OBJECT tag in HTML. For ex. the following code will load the adobe flash player in internet explorer.
If you want to load you activex control, just change the following classid with your control classid.
<html>
<body>
<OBJECT height=150 width=150 align=middle classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>
<PARAM NAME="background" VALUE="transparent">
<PARAM NAME="BGCOLOR" VALUE="#CCCCFF">
</OBJECT>
</body>
</html>
|
|
|
|
|
I know this is not a serious warning, if you could even call it that, but it's annoying.
First-chance exception at ... Access violation reading location ...
Is there any way to find the cause and make the thing go away so that I can have my output window filled with something useful?
Waldermort
|
|
|
|
|
It may indeed indicate a serious problem. To find out what's causing it (VS 2005) tick the check box under Debug->Exceptions, Win32 Exceptions for c0000005 Access violation in the Break when Thrown column. Run your code and see where the exeception is being raised.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks for that.
The exceptions are being thrown as a result of using the TreeView_xxx set of macros, using SendMessage instead seems to resolve the problem. Wonder why this is happening? Time to do some googling...
Waldermort
|
|
|
|
|
Hello Friends,
Can we put the Custom Icon in the Balloon Tool Tip instead of the Windows icons ??
If yes can you tell me how to do this ?
Thnnks in advance.
|
|
|
|
|
This is a wonderful place for me to learn programme.But sorry to my poor English.There are too many things I cannot read and too much I don't how to say.I wonder how long can I get used to English and be successgul in programming! sigh:
|
|
|
|
|
class="FQ"> bornunique wrote: There are too many things I cannot read and too much I don't how to say.
Doesn't matter that much...
- NS -
|
|
|
|
|
I think that you can read some of these[^] sample-articles.
Then the best way to learn is.... USE it!
Russell
|
|
|
|
|
Do you want to learning C++?
|
|
|
|
|
bornunique wrote: I cannot read and too much I don't how to say
your english seems to quite good. even better then me! you should begin with some sample / beginner article.. as if you go for advance article.. you surly lead your self in trouble. best place for you here would be http://www.codeproject.com/cpp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|