|
followait wrote: //Do I need to free var.parray here?
That depends. Do you still need access to var before main() ends? Otherwise, if main() ends, then the memory will be automatically freed.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I have a project here at my work due Monday and it involves 23,000+
records to be manually typed into a database requiring the fields LEN:, DN:, and the NCOS: on the same line. I just know that there is an easier way of doing it. I have been working with the sed utility in Linux to help me but now I would like to know how to write an Win32 executable that can ask for the file name and filter these values for me and insert them into a text file. I have a fair amount of C++ programming experience but I do not know how to using file streams. Any help would be greatly appreciated by myself and my coworkers. A sample of a record I have is:
MADN SPECIFIED. LEN OUTPUT IS FOR PRIMARY.
-------------------------------------------------
LEN: HOST 02 0 02 11
TYPE: MULTIPLE APPEARANCE DIRECTORY NUMBER
SNPA: 315
DIRECTORY NUMBER: 6344010 (NON-UNIQUE)
LINE CLASS CODE: IBN
CUSTGRP: KAFB SUBGRP: 0 NCOS: 52
Here is a link to a thread where I was using sed:
http://www.linuxquestions.org/questions/linux-software-2/using-sed-to-extract-a-pattern-plus-a-number-of-positions-after-679435/
|
|
|
|
|
Michael Randolph wrote: MADN SPECIFIED. LEN OUTPUT IS FOR PRIMARY.
-------------------------------------------------
Do these two lines appears once at the top of the file?
Michael Randolph wrote: LEN: HOST 02 0 02 11
TYPE: MULTIPLE APPEARANCE DIRECTORY NUMBER
SNPA: 315
DIRECTORY NUMBER: 6344010 (NON-UNIQUE)
LINE CLASS CODE: IBN
CUSTGRP: KAFB SUBGRP: 0 NCOS: 52
Do these 6 lines repeat (for each record)?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Yes if you check out this link there is more info on what I'm trying to do..... http://www.codeguru.com/forum/showthread.php?t=464131
|
|
|
|
|
I see some inconsistency. Are the rows of dashes used to separate records, and are there always two rows of them? How many rows are there between OPTIONS: and the first row of dashes? Are the two rows starting with MADN: optional? Can you provide 1-3 more records so that a pattern is more evident?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I am currently writing a program using C++ and MFC. I am thinking that my users would like to see their output saved in a PDF file. The output will contain at least one graph (as in X - Y plot). Are there any class libraries that will help me produce this PDF output?
Thanks
Bob
|
|
|
|
|
|
Let me rephrase, where can I find a C++ class library that I can use in my program. Ideally, the price of the library should be free?
Thanks
Bob
|
|
|
|
|
Sorry Bob. I should have slept last night.
Ehrm, do you need a c++ class-lib, or will you settle for a non class-oriented implementation?
I suppose you've already seen this page: http://www.adobe.com/devnet/pdf/library/[^]
How about pango, have you considered that? I'm under the impression that it's not always so fun to build - though I can confirm having made a program using it, that gets the time and then draws an analogue clock as the only object in the pdf.
Ahrm, are you adverse to reverse-engineering? You could always grab a c# library, then pull it apart with .NET Reflector and Deblector & Reflexil, before putting it back together with a C++.
Then of course, there's always the list of 340 articles at CP. Dunno if/which of them are any good.
http://www.codeproject.com/info/search.aspx?artkw=PDF[^]
|
|
|
|
|
Thanks for the response. As I understand it, the Adobe library is expensive. I am looking for something that is free. Maybe that is unrealistic on my part. Also, I would rather not reverse engineer another library. For the application I am working on, I believe, PDF output is not that important.
Bob
|
|
|
|
|
I have just recently (only two days) been on the MASM32 forum and I thought that I saw a free application that created PDF (still need Adobe to read it).
Dave.
|
|
|
|
|
|
Thanks for the response. I will look into it.
Bob
|
|
|
|
|
|
I have a problem using a C++ written Dll using strings to return values.
Could someone give me a hint how to write a dll function to be used in C++ and C#.
At the moment I only found solutions working for C# or C++ but not both. Other language always have memory trash after calling the function, because the "original" variable within the dll is destroyed after call.
I would like to get hints which type to use for implementation within the dll.
I could change all progs, C++, C# and dll. So any solution would be helful to me.
Simple example how it would be simplest, but of course not working:
C++ Prog :
CString ReturnBuffer;
CallDllFunction(ReturnBuffer)
C# Prog :
string ReturnBuffer;
CallDllFunction(ReturnBuffer);
Dll (C++)
void CallDllFunction(CString &ReturnBuffer)
{
CString Test = "Teststring";
ReturnBuffer = Test;
}
Hope someone could help me. Thanks.
|
|
|
|
|
C# doesn't know anything about CString so it can't marshal as a String.
You could maybe use a LPWSTR as a parameter...here's a string-safe example:
extern "C" __declspec(dllexport) void CallDllFunction(LPWSTR ReturnBuffer, int buflen)
{
CStringW Test = L"Teststring";
wcscpy_s(ReturnBuffer, buflen, Test);
}
[DllImport("TestWin32DLL.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void CallDllFunction(StringBuilder buf, int buflen);
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder(260);
CallDllFunction(sb, 260);
...
extern "C" __declspec(dllimport) void CallDllFunction(LPWSTR ReturnBuffer, int buflen);
void somefunc()
{
CStringW ReturnBuffer;
CallDllFunction(ReturnBuffer.GetBuffer(260), 260);
ReturnBuffer.ReleaseBuffer();
...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Much thanks. This worked for me, but it was a hard fight to make it run within the programs I needed it. But finally it did. It helped me a lot.
I knew that CString (C++) and string (C#) is not the same. Example only was to demonstrate what I wanted.
|
|
|
|
|
You're making a wrong assumption when you pass C# string class as C++ CString class. The fact that string sounds like CString doesn't make the two classes equivalent. CString is a C++ class, and C# doesn't have it.
Better make a function that takes a pointer and size as parameters, then fills them with the string.
void CallDllFunction(const char* buffer, int n)
{
CString Test = "Teststring";
strncpy(buffer, Test, n);
}
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
hi
i have a dialog based MFC application with a web browser control
i have created it dynamicaly with CWnd wrapper class
i am creating control like below
and i want to control contex menu of the web browser
int CHolderWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
DWORD dwStyle = WS_CHILD|WS_VISIBLE;
m_pWebCtrl = new CWebBrowser2;
if(!m_pWebCtrl->Create(NULL,NULL,dwStyle,CRect(0,0,0,0),this,ID_WEB_WINDOW))
{
return -1;
}
return 0;
}
after some search i found this link http://msdn.microsoft.com/en-us/library/aa770042(VS.85).aspx[^]
but i do not know how to use it
can you give me a clue about how to start this task
thank you
|
|
|
|
|
|
Hello,
I wrote a COM object (for WinMobile 6) that handles the download of specific mime types and extensions, using IPersistMoniker and IBindStatusCallback interfaces implementations.
I've registered the CLSID and the mime types and extensions I need.
Download of direct links works great, the problem starts when trying to download a link with content disposition attachment in its header - my DLL is being loaded, and IUnknown and IPersistMoniker interfaces are being requested as they should - but release right after the QueryInterface.
I've noticed that those links (with the content disposition) ignore the mime type registration and follow only the extension regstration (with CLSID or ProgID). Also, if I edit the extension key to run some EXE file (even iexplore) instead of my DLL - it works well.
How should I handle links with content disposition?
Thanks,
Keren
|
|
|
|
|
|
Hi,
how do I use GetProcessID? I couldn't find any articles at MSDN!
Ive already searched and put this into my code:
GetProcessID("cmd.exe");
but my compiler (g++) says that it was not declared!?
I included windows.h and iostream, do I have to include any libraries?
|
|
|
|
|
fvcker wrote: how do I use GetProcessID? I couldn't find any articles at MSDN!
The last letter is not supposed to be capital.
For more info:GetProcessId[^]
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
doesn't make a difference
|
|
|
|