473,466 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

evc++: splitting string into array using strtok

13 New Member
Hi,

I am using embedded visual C++ 4.0 and I want to use function strtok to split string into array.

my sample code is as below:

----------------------------------------------------------------
void CNEWSERIALNO::OnBInsert()
{
// TODO: Add your control notification handler code here
char seperator[] = "|";
int i;

i = 0;

char *token;

token = strtok("xxxx|ffff", seperator);

while( token != NULL )
{
AfxMessageBox(_T("token"),MB_OK);
// Get next token
token = strtok( NULL, seperator );
}
}
----------------------------------------------------------------

When I compile and build the application, there is no error shown. However, when i try to Click the OnBInsert Button, it does not function like what I expect which 2 message box will appear. It just do nothing, and then after i close the CNEWSERIALNO dialog. all the main form button cannot work include menubar.

Can someone help me ob this matter.

Thanks in advance.

Best Regards
May 2 '06 #1
2 8690
bluebeta
13 New Member
Hi,

I have found another problem when casting. Below is my sample code:
-------------------------------------------------
UpdateData (TRUE);
CString sSerialNo(m_sSerialNo);
char input[] = (char)(LPCTSTR)sSerialNo;
-------------------------------------------------
m_sSerialNo is a member varibale of edit box. when i compile, I get this error.

C:\Documents and Settings\user1\My Documents\MobileInventory\NEWSERIALNO.cpp(57) : error C2440: 'initializing' : cannot convert from 'char' to 'char []'

how should I fix this, can someone pls help.
May 2 '06 #2
bluebeta
13 New Member
problem solved.
May 3 '06 #3

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

Similar topics

26
by: Kai Jaensch | last post by:
Hello, i am an newbie and i have to to solve this problem as fast as i can. But at this time i don´t have a lot of success. Can anybody help me (and understand my english :-))? I have a...
3
by: Kai Jaensch | last post by:
Hello, i am an newbie and i have to to solve this problem as fast as i can. But at this time i don´t have a lot of success. Can anybody help me (and understand my english :-))? I have a...
10
by: Eric BOUXIROT | last post by:
hi there, i'm working on a smart application project on VB.NET. i must call API (custom eVC++ DLL) but i have some trouble with mashalas attribute..... i have copy/past a sample on msdn help but...
13
by: Pedro Pinto | last post by:
Hi there. I'm trying to do the following. I have a string, and i want to separate it into other halves. This is how it should be: char string = "test//test2//test3"; were // is the part...
29
by: Andrea | last post by:
I want to write a program that: char * strplit(char* str1, char *str2, char * stroriginal,int split_point) that take stroriginal and split in the split_point element of the string the string...
2
by: shadow_ | last post by:
Hi i m new at C and trying to write a parser and a string class. Basicly program will read data from file and splits it into lines then lines to words. i used strtok function for splitting data to...
3
by: Alexander Adam | last post by:
Hi! I've got an input wchar_t array in a callback function from expat: void my_callback(const wchar_t* data); Additionally, I got a second function that I need to call within my callback...
6
by: Studlyami | last post by:
Okay, i have developed a file parser in C++ that i am trying to being into a c# program which is proving to be a lot more difficult than i thought. first i scan a file (which i opened using a...
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,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.