473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

[HELP] How to remove duplicate char array

right now i have gotten all the classes to print out using helpdbg. Now i want to remove the duplicate class names out of an array so i can just print one of each.
This is the output i have.

[HTML]class URopeBeamEmitter;
class AAGP_GameInfo;
class AAGP_Weapon;
class ABaseScope;
class AInfantryHUD;
class UCamEffect_BlurOut;
class URopeBeamEmitter;
class AAGP_GameInfo;
class AAGP_Pawn;
class AAGP_Weapon;
class AAgentController;
class ABaseScope;
class AHumanController;
class AInfantryHUD;
class ALaserProjector;
class UCamEffect_BlurOut;
class UCamEffect_FlashBang;
class URopeBeamEmitter;
class AAGP_Pawn;
class AAgentController;
class AHumanController;
class ALaserProjector;
class UCamEffect_FlashBang;
class AAGP_GameInfo;
class AAGP_Weapon;
class ABaseScope;
class AInfantryHUD;
class UCamEffect_BlurOut;
class URopeBeamEmitter;
class AAGP_Pawn;
class UCamEffect_BlurOut;
class AAGP_Pawn;
class URopeBeamEmitter;
class URopeBeamEmitter;
class AHumanController;
class AAGP_Pawn;
class URopeBeamEmitter;
class AAGP_GameInfo;
class AAGP_Weapon;
class ABaseScope;
class AInfantryHUD;
class UCamEffect_BlurOut;
class URopeBeamEmitter;
class URopeBeamEmitter;
class URopeBeamEmitter;
class AHumanController;
class AAGP_Pawn;
class URopeBeamEmitter;
class UCamEffect_FlashBang;
class AAGP_GameInfo;
class AAGP_Weapon;
class ABaseScope;
class AInfantryHUD;
class UCamEffect_BlurOut;
class URopeBeamEmitter;
class AAGP_Pawn;
class URopeBeamEmitter;
class AAGP_GameInfo;
class AAGP_Weapon;
class ABaseScope;
class AInfantryHUD;
class UCamEffect_BlurOut;
class URopeBeamEmitter;
class AAGP_Pawn;
class AAGP_Pawn;
class AAGP_Pawn;
class AAGP_Pawn;
class URopeBeamEmitter;
class AAGP_Pawn;
class AAGP_Pawn;
class AHumanController;
class AAGP_Pawn;
class AAgentController;
class AHumanController;
class UCamEffect_BlurOut;
class AHumanController;
class AAGP_Pawn;
class AAGP_Weapon;
class AHumanController;
class AHumanController;
class AHumanController;
class UCamEffect_FlashBang;
class AAGP_Pawn;
class AAGP_Pawn;[/HTML]

as you can see many duplicate names. I just need hint or so how to remove them from my array.
Apr 18 '07 #1
4 3388
JosAH
11,448 Expert 8TB
Have a look at a set<string> object. Add all your strings to a set (which
doesn't allow duplicates) and get them back again out of the set<string>

kind regards,

Jos
Apr 18 '07 #2
gpraghuram
1,275 Expert 1GB
HI,
if u want to remove the duplicates from the output then you have to use some unix commands.
If u want to remove it inside C++ code then try to push the values into a map(STL) and then print it.

Thanks
Raghuram
Apr 18 '07 #3
ayan4u
86
i thnk set<string> option is much more relevant in this case than maps as thrs only strings here and he is not associatng strings with other type of objects...
Apr 18 '07 #4
Thanks for the info. I will most likely try both ways. To see which one is more efficient for my program. I got my output of the class names by cuting the strings from the undecorated names shown below:


[HTML] DWORD dwErr = UnDecorateSymbolName(szName, DLLFunctions, sizeof(DLLFunctions), UNDNAME_COMPLETE);

if(dwErr == 0)
{
dwErr = GetLastError();
TCHAR lpMsgBuf[1000];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), lpMsgBuf, 1000, NULL );
}


if(strstr(DLLFunctions, "::"))
{
strcpy(DLLFunctions + (strstr(DLLFunctions, "::") - DLLFunctions),"\0");
strcpy(DLLFunctions,DLLFunctions + ((strrchr(DLLFunctions,' ') + 1) - DLLFunctions ));
strcpy(ClassName, DLLFunctions);
strcpy(ClassName2, DLLFunctions);

fprintf(HeaderFile, "class %s;\n", ClassName);

}[/HTML]

Now my next step is to get all the correct functions associated with that class in the proper class: though right now its only printing one function in each class instead of all of them



[HTML] fprintf(HeaderFile, "\n");
fprintf(HeaderFile, "//---------------------------------------------------------------------------------\n");
fprintf(HeaderFile, "//class %s.%s Generated from DLL and U file\n", argv[1], ClassName );
fprintf(HeaderFile, "//---------------------------------------------------------------------------------\n");

fprintf(HeaderFile, "\nclass %s_API %s : public ?\n{\n", cpyargv, ClassName);

fprintf(HeaderFile, "\t%s;\n", DLLFunctions);


fprintf(HeaderFile, "};\n\n");[/HTML]


heres the example of the print out:

[HTML]class AGP_API AAGP_Pawn : public ?
{
public: virtual void __thiscall AAGP_Pawn::stepUp(class FVector,class FVector,class FVector,struct FCheckResult &);
};[/HTML]

as for the ? for the parent class will have to be done later when i get the info from the data already contain in other files.
Apr 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Patrick G. | last post by:
Greetings all: ASP VB, SQL Svr 2000 I am pulling data from 3 tables. table1 holds item details table2 holds publication types and the item id from table1 table3 holds category types and...
4
by: Greg Baker | last post by:
I don't know what standard protocol is in this newsgroup. Am I allowed to post code and ask for help? I hope so.. :) Here's my problem: I am trying problem 127 of the valladolid online...
23
by: mrvendetta1 | last post by:
#include <stdio.h> #include <string.h> #include <stdlib.h> #define N 33 void StringToIntArray(const char *s1); void takeinteger(int i); int main() { char string; printf("enter a string of...
12
by: kalinga1234 | last post by:
hy guys i am having a problem with my sudoku program which i coded using c++.; currently in my program if a duplicate number exist in either row/column/block i would make the particualr square...
7
by: ucfcpegirl06 | last post by:
Hello, I have a dilemma. I am trying to flag duplicate messages received off of a com port. I have a software tool that is supposed to detect dup messages and flag and write the text "DUP" on...
0
by: mithubabu1970 | last post by:
Hello Friends.. I am working on some Pro-C program using Dynamic SQL. I am fetching a set of values and storing those in an host variable array of datatype long. The fetching into the array is...
5
by: weidongtom | last post by:
Hi, I tried to implement the Universal Machine as described in http://www.boundvariable.org/task.shtml, and I managed to get one implemented (After looking at what other's have done.) But when I...
3
by: powerej | last post by:
im having trouble printing an array with duplicate characters, i can enter and print with single characters but when i try and enter and print duplicate ones it puts blanks in my output for a sorted...
2
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.