|
Faez Shingeri wrote: rewind(fp1);
rewind(fp2); These are unnecessary.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I thought rewind will help me during the reuse of the file..
The replace function doesnot check for the entire string
I mean.. it replaces all the strings like &tabhostvars and &tabhostvars01 (I do not want this string to be replaced..) I only want &tabhostvars strings to be replaced
Can I do this..?? #vaguequestionButlearning
while ((find_ptr = strstr(buff_ptr,text2find)) && find_ptr+find_len+1 == NULL)
Thanks,
Faez
|
|
|
|
|
Faez Shingeri wrote: I thought rewind will help me during the reuse of the file..
But you are not reusing the file. It is being closed. When replace() is called again, a whole new file pointer is generated. The fact that it is the same filename is irelevant.
Faez Shingeri wrote:
while ((find_ptr = strstr(buff_ptr,text2find)) && find_ptr+find_len+1 == NULL) This is an accident waiting to happen.
Provide a sample of your input file, what string(s) you want replaced, and what string(s) you do not want replaced.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Sample File to be parsed and replace different strings..
*************************************************************************
* API TEMPLATE PROGRAM *
* THIS PROGRAM SERVES AS A TEMPLATE TO GENERATE THE ACTUAL API PROGRAM *
* *
* MAPPING RULES: *
* -------------------------------------------------------------------- *
* Variable Name Replace with *
* -------------------------------------------------------------------- *
* &apiname API Name from Mapping Repository *
* &dclgen DCLGEN name from Mapping Repository *
* &keyinfo Key field column name from file layout *
* &hostvarprimary Key field host var name from DCLGEN *
* &tablecols Table column name from DCLGEN *
* &tablehostvars Host variable names from DCLGEN *
* &tblprimary Key field column name from DCLGEN *
* &tablehostvars01 01 level of host var from DCLGEN *
*************************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. &apiname.
EXEC SQL
INCLUDE &dclgen
END-EXEC.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
2100-SELECT-PARA.
MOVE &keyinfo TO &hostvarprimary
EXEC SQL
SELECT &tablecols
INTO
&tablehostvars
FROM &tblname
WHERE
&tblprimary = &hostvarprimary
END-EXEC
IF SQL-CODE EQUAL ZERO
SET FUNC-SUCCESS TO TRUE
MOVE &tablehostvars01 TO VSAM-REC-BLOCK
ELSE
PERFORM 9999-ABEND-PARA
END-IF.
2100-SELECT-PARA-EXIT. EXIT.
2200-INSERT-PARA.
MOVE VSAM-REC-BLOCK TO &tablehostvars01
EXEC SQL
INSERT INTO &tblname
(
&tablecols
)
VALUES
(
&tablehostvars
)
END-EXEC
IF SQL-CODE EQUAL ZERO
SET FUNC-SUCCESS TO TRUE
ELSE
PERFORM 9999-ABEND-PARA
END-IF.
2200-INSERT-PARA-EXIT. EXIT.
2300-UPDATE-PARA.
MOVE VSAM-REC-BLOCK TO &tablehostvars01
EXEC SQL
UPDATE &tblname
SET &tablecols = :&tablehostvars
WHERE
&tblprimary = &tablehostvarsprimary
END-EXEC
IF SQL-CODE EQUAL ZERO
SET FUNC-SUCCESS TO TRUE
ELSE
PERFORM 9999-ABEND-PARA
END-IF.
EXIT PROGRAM.
I shall paste below my exact replace function too
replace(char text2find[80],char text2repl[80],char fileOrig[32], char fileRepl[32] )
{
char buffer[MAX_LEN_SINGLE_LINE+2];
char *buff_ptr, *find_ptr, *tok;
FILE *fp1, *fp2;
size_t find_len = strlen(text2find);
fp1 = fopen(fileOrig,"r+");
fp2 = fopen(fileRepl,"w+");
rewind(fp1);
rewind(fp2);
while(fgets(buffer,MAX_LEN_SINGLE_LINE+2,fp1))
{
buff_ptr = buffer;
tok = strtok(buff_ptr,"*");
if(tok != NULL)
{
while ((find_ptr = strstr(buff_ptr,text2find)))
{
while(buff_ptr < find_ptr)
fputc((int)*buff_ptr++,fp2);
fputs(text2repl,fp2);
buff_ptr += find_len;
}
fputs(buff_ptr,fp2);
}
}
fclose(fp2);
fclose(fp1);
}
Thanks,
Faez
|
|
|
|
|
Can you search for "tablehostvars " (note the space) instead of "tablehostvars"?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
hai friends please helpme to complete my project...
i have only 25 hours time to complete that above project if any body have that source code please send to this mail id b.manmadkumarreddy@gmail,
manmadb32@gmail.comimmediately please help me.......
|
|
|
|
|
Nobody here is going to do your work for you.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
manmadkumarreddy wrote: i have only 25 hours time to complete that above project
Don't you think you left it a bit late?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
manmadkumarreddy wrote: have only 25 hours time to complete that above project
Who on earth have 25 hours for you?
|
|
|
|
|
manmadkumarreddy wrote: 25 hours time to complete
manmadkumarreddy wrote: source code please send
As soon as I receive payment, I will get started on that for you.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Hi,
If you know please tell me where i can find gSpan source code, it used in Data Mining to find out supgraph.
Thanks!
|
|
|
|
|
Google[^] is always the first place to look.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I have search gSpan by google, but the code i find which need the environment with matlab. But i don't have matlab. What i want is a source code implemented only on C or C++ which i can run it by Microsoft Visual Studio and Dev-C++.
Thanks for your reply
|
|
|
|
|
linnumberone wrote: I have search gSpan by google, but the code i find which need the environment with matlab.
What about these links[^]?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I have search this term in google, but all the resource i found cannot run in Microsoft Visual Studio 2010, i will try to find it, but if anyone know where i can find or how to implement, please tell me, thanks
|
|
|
|
|
|
Looks like that's your only option... if you want something that C++ exclusively, find another suitable library or write your own.
|
|
|
|
|
Hi coders,
IIT Roorkee is presenting an Algorithm Intensive Online Programming
Contest – INSOMNIA, during their annual Tech Fest COGNIZANCE '12.
INSOMNIA is known around the globe and some of the best coders
participate in this reputed competition. The event has a total prize
money of INR 50,000/-
INSOMNIA will be held for 12 hours from 9:00 PM IST (+5:30 GMT), 11th
February to 9:00 AM IST, 12th February 2012. There could be maximum 2
members in a team. Team member may be of different colleges /
professions.
To participate in the contest, first visit
(http://www.cognizance.org.in/) and register each team member
indivisually on it. Then register your team at INSOMNIA website
(http://www.insomnia.cognizance.org.in/). The contest will also be
held on the same site.
Looking forward to your participation.
Coordinators:
Aditya Gupta (adityagupta104@gmail.com) – (+91-7417015693)
Deshank Baranwal (deshank@gmail.com ) - ( +91-9557020929)
Dipit Grover – (+91-9557647167)
Kapil Agrawal – (+91-9568380650)
Important Note: For further queries refer to ‘Rules’ on the site or
email to any of the coordinator or write to Email ID-
insomnia.cogni@gmail.com.
|
|
|
|
|
Hello, I'm wondering how would you programmatically install your program in the Windows Action Center on the antivirus section, to where it says "COMODO antivirus is currently running and up to date." How would you do it to make your own program (e.g., "Windows Application-1 is currently running and up to date.")
Regards,
Brandon T. H.
|
|
|
|
|
|
Thanks for the response, seems that Microsoft keeps the information discreet from anyone out there that's gonna use it in a bad way, but I'll try exploring my registry keys, and see if I find anything that grabs my attention, and keep researching about it see if there is such a way. I mean other anti viruses can do that, I wonder how they can though...
|
|
|
|
|
Brandon T. H. wrote: I mean other anti viruses can do that, I wonder how they can though...
My first guess would be they have a (contractual) relationship with MS that gives them access to such information. Sort of like how hardware mfg's get access to the early versions of a new OS so they have ample time to get drivers and such ready.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I just want to get a check to see if my translation of the Mod Operator in VB to c++ is even close to right, or if there is a c++ equivalent to Mod, where I can just use Mod or something close to it.
edit:
I'm not sure if the null terminate char will produce a different result in the c++.
So I have these lines of code to translate.
strTextChar = Mid(strDomainName, (i Mod Len(strDomainName)) + 1, 1)
strKeyChar = Mid(ApplicationName, (i Mod Len(ApplicationName)) + 1, 1)
szTextChar = &szDomainName[ ( i - ( wcslen(szDomainName)) * (i / wcslen(szDomainName)) ) + 1 ];
szKeyChar = &pzApplicationName[ ( i - ( wcslen(szApplicationName)) * (i / wcslen(szApplicationName)) ) + 1 ];
I have this other line of code to translate, this one is more complex, just thought I would throw it out there. I took a peek at Xor, it's not quite sinking in yet.
strTextChar = Chr(Asc(strTextChar) Xor intTemp)
|
|
|
|
|
% is the modulo operator in C++ and C# and most similar languages.
Philippe Mori
|
|
|
|
|
Thanks Philippe!
I took off the +1 for the null terminator
szTextChar = szDomainName[ (i % wcslen(szDomainName)) ];
szKeyChar = pzApplicationName[ (i % wcslen(szDomainName)) ];
|
|
|
|