Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Is there a token function?
Is there a token function? [message #2716] Sat, 22 April 2006 22:06 Go to previous message
forlano is currently offline  forlano
Messages: 1207
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

my application now needs to read a file. I've already my old C function for this purpose. Because I want to make available the source code of the new rewritten application I would like to use all the U++ facilities and get rid all C functions and its flavour.

The question: at some moment my file become formatted and ';' delimited... like this:
NAME;            COUNTRY;BIRTHDAY;G;TITLE;IDFIDE;ELOFIDE; IDNAT;ELONAT;K;ISAVAL
AAAAAAA             ;---;00.00.00;m; GM;       0;    0;       0;    0; 0;1
BBBBBBB             ;---;00.00.00;m; GM;       0;    0;       0;    0; 0;1
CCCCCCC             ;---;00.00.00;m; GM;       0;    0;       0;    0; 0;1
...

I need to extract the field beetwen consecutive ';' in each row-record. In the past I've used the strtok() function. Is there something equivalent in U++ ? I've investigated all the code available but without success.

I've found a C++ token function here
http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programmi ng-HOWTO-7.html
I'll try to adapt it in U++ if there is not yet one.

Luigi

PS: BTW, I'm going to use the cin operator to read the txt file. Please stop me if there is some smartest way to do it.

PPS: I spent the afternoon to learn I/O in C++. Surfing the web I found this reference that says something (but not useful in concrete sense) about serialization
http://www.parashift.com/c++-faq-lite/serialization.html#faq -36.11
I reminded that U++ has such feature. I wonder if it can be useful in my case or it is an argument too advanced for the moment and/or not useful for such application (it needs to save data at some moment inside 2 text files).
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is there a function to remove leading white space?
Next Topic: TimeDate.cpp [BUG][FIXED]
Goto Forum:
  


Current Time: Tue Jul 08 08:11:11 CEST 2025

Total time taken to generate the page: 0.02854 seconds