Click here to Skip to main content
16,005,389 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCTreeCtrl and SetCheck Pin
Matt Gullett24-Feb-02 9:15
Matt Gullett24-Feb-02 9:15 
GeneralRe: CTreeCtrl and SetCheck Pin
Derek Waters24-Feb-02 11:48
Derek Waters24-Feb-02 11:48 
GeneralRe: CTreeCtrl and SetCheck Pin
Matt Gullett24-Feb-02 13:05
Matt Gullett24-Feb-02 13:05 
GeneralRe: CTreeCtrl and SetCheck Pin
Ken Goguen26-Feb-02 9:01
Ken Goguen26-Feb-02 9:01 
GeneralRe: CTreeCtrl and SetCheck Pin
Carlos Antollini26-Feb-02 9:25
Carlos Antollini26-Feb-02 9:25 
QuestionAnsiString searching? Pin
Steven Richardson24-Feb-02 9:05
Steven Richardson24-Feb-02 9:05 
AnswerRe: AnsiString searching? Pin
Orbital^25-Feb-02 3:29
Orbital^25-Feb-02 3:29 
GeneralToken and parsing Pin
HomeNuke24-Feb-02 8:47
HomeNuke24-Feb-02 8:47 
I have a current project going at work and since I'm the only developer here would like to use you guys as a sounding board, hope no one minds. Here's my current project I have a text file that extracts total counts by different codes into a main text file. Here is an example of a couple lines from the text file:
3AAA,       789
4EFJ,R321    90
5BBB,3AAA     6
etc...


Now what I'm doing is reading in the file with CStdioFile and tokenizing each line and inserting relevant information into a structure like:

struct Data{
   char* Code;
   long Amount;
};


by using the strtok() function I have to keep a counter during the tokenizing portion of the program in order to back track from an array of struct Data I created in order to fill in the Amount field with the right amount. Because let's say for example I tokenize the 3rd string I get these tokens:
5BBB
3AAA
6

I do not get the amount value until the very end so I have to go back on 5BBB and 3AAA to add in amount 6. Now this file gets pretty big, and with just going through the array and looking up each string literal to see if it is there or not and then adding the amount I might be using more resources than I need to.

Question to anyone is there a more efficent way to do this? I'm not asking for code examples just methodology. If I got code examples then I couldn't figure out how to write it and then programming becomes no fun Smile | :)

But if there is a more efficient method to do what I'm proposing please let me know, and for further clarification just from the 3 lines at top the final output file looks like:
3AAA       765
4EFG        90
R321        90
5BBB         6


It works now, but I'm thinking there is a more efficent way of doing this...

TIA


HomeNuke
----
"Nuke'd Your Home, Yet?"
Run your own PostNuke based web server from home
http://www.homenuke.com
GeneralRe: Token and parsing Pin
Orbital^25-Feb-02 3:27
Orbital^25-Feb-02 3:27 
GeneralRe: Token and parsing Pin
HomeNuke25-Feb-02 9:24
HomeNuke25-Feb-02 9:24 
GeneralRe: Token and parsing Pin
HomeNuke25-Feb-02 11:47
HomeNuke25-Feb-02 11:47 
Generalshell extension implementing IShellFolder : XP problem Pin
24-Feb-02 7:36
suss24-Feb-02 7:36 
GeneralRemovespaces() Pin
24-Feb-02 7:14
suss24-Feb-02 7:14 
GeneralRe: Removespaces() Pin
Mazdak24-Feb-02 7:25
Mazdak24-Feb-02 7:25 
GeneralFile Database & Data Structure :: C++ Pin
valikac24-Feb-02 6:46
valikac24-Feb-02 6:46 
GeneralRe: File Database & Data Structure :: C++ Pin
Paul M Watt24-Feb-02 15:16
mentorPaul M Watt24-Feb-02 15:16 
GeneralRe: File Database & Data Structure :: C++ Pin
valikac24-Feb-02 15:50
valikac24-Feb-02 15:50 
GeneralSearch a string in another string Pin
24-Feb-02 6:44
suss24-Feb-02 6:44 
GeneralRe: strstr, wcsstr Pin
24-Feb-02 7:06
suss24-Feb-02 7:06 
GeneralRe: Search a string in another string Pin
24-Feb-02 12:41
suss24-Feb-02 12:41 
GeneralAAAAAAAAAAAAAAAARGH! Pin
Georg Haan24-Feb-02 5:52
Georg Haan24-Feb-02 5:52 
Generalsrand() Pin
Mazdak24-Feb-02 5:47
Mazdak24-Feb-02 5:47 
GeneralRe: srand() Pin
Georg Haan24-Feb-02 6:18
Georg Haan24-Feb-02 6:18 
GeneralRe: srand() Pin
Mazdak24-Feb-02 7:16
Mazdak24-Feb-02 7:16 
GeneralRe: srand() Pin
Tim Smith24-Feb-02 7:31
Tim Smith24-Feb-02 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.