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

Parsing a character into an array - C only

2
Want to know what is beleived to be the best approach to parsing an incomming string into an array, using a | Pipe delimiter, (possible to have a || (Would indicate a null value field).

Example a char i_values(3000)

contains
123456789|abc|056789||56789|
May 26 '11 #1
2 1706
weaknessforcats
9,208 Expert Mod 8TB
You may use whatever input layout you choose. The essential thing is that the reader know the inout format.

So 123456 could be 123 as one value and 456 as another value if the reader knows that each value was 3 char.

Using s deliniter, like ||, is fine so long as || does not appear as part of the data. If it does, then you also need and "escape" to tell the reader that the || is data and not a delimiter.
May 26 '11 #2
donbock
2,426 Expert 2GB
Please provide an example. For example, what input would generate the output in your first post?
May 27 '11 #3

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

Similar topics

3
by: Fuzzyman | last post by:
I want to parse some text and generate an output that is similar but not identical to the input. The string I produce will be of similar length to the input string - but a bit longer. I'm...
14
by: Charles L | last post by:
I don't know if this is a stupid quesiton or not. I would like to know how to convert an array of characters generated from a previous operation to a string ie how do I append a null character at...
9
by: Christian Kandeler | last post by:
Hi, if I want to store the string "123456" in a variable of type char, I can do it like this: char s = "123456"; Or like this: char s = { '1', '2', '3', '4', '5', '6', '\0' };
6
by: funmachine | last post by:
Hi there, everyone! I'm a student studying computer animation. But alas, in order to graduate I have to take a programming class and it's kicking my butt. I have two projects left to write (and...
6
by: Kannan | last post by:
Hi, I have question about character array initialization. In section 6.7.8 paragraph number 21, it's given that "If there are fewer initializers in a brace-enclosed list than there are...
3
by: roopa.v1 | last post by:
Hi, How to assign long to character array and later extract it
3
by: Jim Langston | last post by:
Is it possible to initialize a std::string with a character array, not neccessarily null terminated? I.E. Given something like this: char buffer; buffer = 0x01; buffer = 0x00; buffer = 'A';...
14
by: Shhnwz.a | last post by:
Hi, I am in confusion regarding jargons. When it is technically correct to say.. String or Character Array.in c. just give me your perspectives in this issue. Thanx in Advance.
6
by: Spikey | last post by:
Hi, I have a problem that's (probably) very easy to solve, only I'am more a Java programmer and I couldn't find anything like it on the internet. My problem is that I have to add a variable (int,...
2
by: overdrigzed | last post by:
Hello! I wanted to get the full contents of a character array stored in a struct, i.e. _fields_ = however, ctypes seems to try to return struct.array as a Python string rather than a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.