|
My C++ application has to read X amount of files from a directory to parse each one and pick out certain data. The file names of these files are variable and i have no control over them, so i would just want to read every file regardless of name. I would read a file, load it into my XML DOM parser , grab data , then close the file and move on to the next. If there are 50 files in the directory, i want to be able to read all 50 and pull out certain pieces of text from all 50.
Is there a straightforward way to do this using C++ or can anyone point me to some sample code, cause i know there has to be samples on this somewhere.
Thanks..
|
|
|
|
|
Try _findfirst , findnext and _findclose .
There are wide version of these functions as well.
Elaine
The tigress is here
|
|
|
|
|
What would be an example of how to use these methods if my filename is unknown and i just want to open all files one by one in a specific directory?
|
|
|
|
|
Use "*.*" pattern.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how can i return an array?
/\|-||\/|/\|)
|
|
|
|
|
char* GiveArray() {
char* cTab = new char[10];
return cTab;
}
void main(void) {
char* Array = GiveArray();
Array[0] = ;
}
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
If you're using C++ and not C then use a vector instead of an array.
Kevin
|
|
|
|
|
Kevin McFarlane wrote:
If you're using C++ and not C then use a vector instead of an array.
i don't agree. there is not only ONE solution to a problem. vector certainly have some advantages, but they are surely not the best is other cases.
all depends on what you need to do.
vectors are types of lists that are optimized when their size/number of elements vary more than "a few times"...
but they are not the only container to be used ; there is vector, list, stack...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
My point was that he should use a data structure class in preference to a raw array. If you don't have any particular requirements then the recommendation is to go for a vector. For example, see the guidance in Josuttis' The C++ Standard Library.
Kevin
|
|
|
|
|
By definition, a vector is an array.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
My point was to use a vector in preference to a raw array.
Kevin
|
|
|
|
|
|
Hi all,
A while back I wrote a series of middleware apps that need to communicate together (simple notifications between themselves); I've done so successfully using mailslots.
Since mailslots "do not ever guarantee successful delivery of messages" (as per MSDN documentation), I made the communication bi-directional--send a message, wait for confirmation, etc. The system's been running for months now without a hitch--according to my logs, not a single message has been dropped during that timeframe (they're typically generated at a rate of maybe a dozen messages per second when the system is busy).
In the process of replacing some third-party software from a now-defunct company (an Exchange plug-in, essentially), I've written an ATL-based SMTP sink to intercept incoming emails, and need to relay notifications using that mailslot system (I'd like not to change the other components if I can help it as it's been working flawlessly). In effect, I'm replacing one DLL out of the few EXEs that make up the whole system. How the rest of the system works is irrelevant.
I have no problem with the sink itself at this point.
It seems however that now that the code to create a mailslot exists and runs within the context of an SMTP sink (and not the third party's standalone EXE), other apps are denied access--when they try to access the existing mailslot to try to write to it, ERROR_ACCESS_DENIED is returned. On the other hand, I have an EXE that also creates a mailslot, and the SMTP sink DLL has no problem writing to that. The problem is that the DLL also creates its own mailslot, and the EXE cannot write to that.
I'm tempted to change permissions of the process hosting my SMTP sink DLL (thus, the SMTP service), however I'm rather uncomfortable with fiddling with additional permissions on a machine that has a static IP address and runs IIS/SMTP.
What it comes down to is this: an EXE running on the machine is denied access to a mailslot that was also created--on the same machine--by a DLL.
What are my options?
(I suspect I will have to clarify this...)
|
|
|
|
|
Hello. I have two bitmaps - a gradient and a picture. I want to mix their colors.
I do it this way:
hDC = GetDC( hWnd );<br />
hMemDC = CreateCompatibleDC( hDC );<br />
SelectObject( hMemDC, hGradient );<br />
BitBlt(hDC, 0, 0, gradientInfo.bmWidth, gradientInfo.bmHeight, hMemDC, 0, 0, SRCCOPY);<br />
SelectObject (hMemDC, hNumbers);<br />
BitBlt(hDC, 0, 0, numbersInfo.bmWidth, gradientInfo.bmHeight, hMemDC, 0, 540, SRCAND);
But the result is terrible. Please tell me how to mix bitmap colors properly. Thank you.
Xaarquath
|
|
|
|
|
Xaarquath,
Take a look at the "AlphaBlend" function. This is made to do exactly that sort of thing. Essentially, it lets you specify the "opacity" of the image you place in front and blends the two images together accordingly. It functions very much like BitBlt, so you shouldn't have any trouble figuring it out.
pHaze426
|
|
|
|
|
i want to debug with all of the three above debuggers but dont know how to do that? how to set the debuggers , can you please tell me hwo to debug with i386kd.exe , windebug and debugview?
|
|
|
|
|
i want to debug windows intermediate device driver sample and want to do with botj i36kd.exe and windbg.exe , how i start ? how debuggers set to start debugging? is debugview is a good debugger?please help.
|
|
|
|
|
Hello
I am working with MFC. Please can anyone tell me how to use a rich edit control. Infact i want to develope a software just like windows help (i.e. a tree control and a rich edit control). i will have some contents in tree control and corresponding information about each content in rich edit control. Please can anyone help me.
Thanks
Aqueel A. Mirza
We Believe in Excellence
|
|
|
|
|
Aqueel wrote:
I am working with MFC. Please can anyone tell me how to use a rich edit control.
Just add the rich edit control to the dialog resource just like you would any other control. However, you'll most likely be using a CRichEditView in the right pane.
Aqueel wrote:
Infact i want to develope a software just like windows help (i.e. a tree control and a rich edit control).
You'll want to make a Single Document Interface (SDI) application.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
More better way, I think is using SDI application, but use CFormView where u can place both the RichEditCtrl as well TreeCtrl. Add the events whenever u select a item in treectrl and display the corresponding text.
Work hard and bit of luck is KEY to SUCCESS.
|
|
|
|
|
|
hello,
I am reading a file in chunks of 512 bytes(i am reading 2 such
blocks).I am calling SetTimer function.And in corresponding OnTimer function
I am writing code for displaying the file data on a NTGraph control placed in
my dialog box.I am calling the KillTimer function after the 2 chunks of data
are displayed as graphs.
But when i close the dialog or press OK/Cancel button the dialog MFC
application error box appears which asks "whether to send the error report to
microsoft".Why is this coming?First i thought maybe the KillTimer function
isnt properly called but that is not the case since when i debugged the
program i got the result that Killtimer is properly called.
Its after i close the .EXE or press OK to close the dialog then the MFC
error box appears.
please please help fast..
p.s.-as i degugged the program an unexpected exception occurs after i press
OK or Close button
thanks
|
|
|
|
|
you should debug step by step until you find the exact line where it crashes. Have you allocated memory? It could be a memory block not released... With the information you have provided I can't tell you more ... If you find the piece of code that is crashing but you don't know why it crashes you could post it.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
So what are you doing in the OnOK() and OnCancel() methods? Is there anything in the dialog's destructor?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|