473,387 Members | 1,464 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,387 software developers and data experts.

strsep() function Problem, please help

Hi everyone,

I'm trying to get this program compiled under Solaris. I have actually
no idea about programming, sorry to bother you.

Unfortunately Solaris don't use the function strsep() anymore:
char *strsep(char **stringp, const char *delim);

DESCRIPTION
The strsep() function returns the next token from the
string stringp which is delimited by delim. The token is
terminated with a `\0' character and stringp is updated to
point past the token.

RETURN VALUE
The strsep() function returns a pointer to the token, or
NULL if delim is not found in stringp.

I need to use a function that Solaris knows about. Tried to simply
substitute strsep() with strtok() which didn't work. The string which I
need to port is:

while (fgets(buf, sizeof(buf), desc) != NULL) {
w = buf;
if ((p = strsep(&w, " \t")) == NULL)
continue;
..
..
..
Any help would be greatly appreciated since google and everyone I know
couldn't help.

-Dan

Jul 23 '05 #1
2 6470
da****@best.de wrote:
I'm trying to get this program compiled under Solaris. I have actually
no idea about programming, sorry to bother you.

Unfortunately Solaris don't use the function strsep() anymore:
char *strsep(char **stringp, const char *delim);

DESCRIPTION
The strsep() function returns the next token from the
string stringp which is delimited by delim. The token is
terminated with a `\0' character and stringp is updated to
point past the token.

RETURN VALUE
The strsep() function returns a pointer to the token, or
NULL if delim is not found in stringp.

I need to use a function that Solaris knows about. Tried to simply
substitute strsep() with strtok() which didn't work. The string which I
need to port is:

while (fgets(buf, sizeof(buf), desc) != NULL) {
w = buf;
if ((p = strsep(&w, " \t")) == NULL)
continue;


If I remember correctly (and you can verify it by RTFMing), separation
of the string is usually done by _repeated_ calls to 'strtok' and passing
NULL as the first argument on the second and the subsequent calls, until
it returns NULL. That is definitely different from 'strsep' as it is
specified in your post. So, replacing 'strsep' with 'strtok' won't work.

Your question seems to be rather of the C sort, and, since there is no
standard 'strsep' function (i.e. it's platform-specific) you should maybe
ask in a C newsgroup or in the Solaris newsgroup...

I would recommend using 'std::string' and its member function 'substr',
but if you 'have actually no idea about programming', you should perhaps
find somebody who does and hire him/her...

V
Jul 23 '05 #2

<da****@best.de> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
Hi everyone,

I'm trying to get this program compiled under Solaris. I have actually
no idea about programming, sorry to bother you.

Unfortunately Solaris don't use the function strsep() anymore:
char *strsep(char **stringp, const char *delim);

DESCRIPTION
The strsep() function returns the next token from the
string stringp which is delimited by delim. The token is
terminated with a `\0' character and stringp is updated to
point past the token.

RETURN VALUE
The strsep() function returns a pointer to the token, or
NULL if delim is not found in stringp.

I need to use a function that Solaris knows about. Tried to simply
substitute strsep() with strtok() which didn't work. The string which I
need to port is:

while (fgets(buf, sizeof(buf), desc) != NULL) {
w = buf;
if ((p = strsep(&w, " \t")) == NULL)
continue;
.
.
.
Any help would be greatly appreciated since google and everyone I know
couldn't help.

-Dan


You can use C++ features instead of strsep().
Look at http://groups-beta.google.com/group/...3a5c6335?hl=en
--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
2
by: Chris Michael | last post by:
Hello everybody, Newbie here. I've been working on this for the last two days and I can't figure out where this problem is. I think it's something so obvious, but I can't see it! OK, firstly...
4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
9
by: daniel | last post by:
Hi everyone, I'm trying to get this program compiled under Solaris. Unfortunately I have little experience with C. Solaris doesn't use the function strsep() anymore: char *strsep(char...
5
by: mk | last post by:
Greetings all - im new to this newsgroup so pls dont flame me :p I need some help! Please view the html below in a browser. Or goto this url -http://firebrain.co.uk/java-problem.htm (Assuming...
3
by: drummond.ian | last post by:
Hello Everyone, This problem's been causing me a lot of trouble and I'm hoping somebody can help me out!! I have a dialog-based MFC application in visual studio 2003. I want to call a...
9
by: shror | last post by:
hi every body, i have a problem which is when i was checking my mail() form it work fine but the problem is that the form configuration is not set correctly, in details: the from var is not...
8
by: cpptutor2000 | last post by:
Could some C guru please help me? I have a function that takes as an argument a pointer to an array of unsigned chars (basically a hex representation of a dotted decimal IP address). When I print...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.