473,499 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Editing a CSV file in a C++ Program

7 New Member
Hello All & Thank You in advance for any responses to my question.

I am writing a program at work and need a few syntax specific pointers. I will be as clear as I am able. I can program in C++ but I am a little rusty.

I need to write a program that throws an error code out when an address in the csv file do not meet a certian format. How would i setup the format after importing the file?

Correct format example: 3456 E. 36th St W
Incorrect format example: 3456 E 36 ST

I do not know how to approach making the program look for ###(space)(LETTER).##(space)(TWOCAPITALLETTERS)(sp ace)(CAPITALLETTER)

I know how to import the file, I know how to write to a file, i just don't know how to put this logic into an if/else or switch statement.

Please Help!
Aug 16 '07 #1
6 3139
sicarie
4,677 Recognized Expert Moderator Specialist
Looks like a very good setup for a regex.

Does this look like it might help?

I'm sure you can do it with strings and tokens as well, but I think using a regex that will either pass or fail will be easier for you, and then you can just throw the string to stdout or whatever you want it on fail.
Aug 16 '07 #2
Brad King
7 New Member
Looks like a very good setup for a regex.

Does this look like it might help?

I'm sure you can do it with strings and tokens as well, but I think using a regex that will either pass or fail will be easier for you, and then you can just throw the string to stdout or whatever you want it on fail.
Is this going to be case sensitive if i use the | "or" function?
Aug 16 '07 #3
oler1s
671 Recognized Expert Contributor
Is this going to be case sensitive if i use the | "or" function?
| is not a function. It is an operator. Wait, what exactly are you talking about?
Aug 17 '07 #4
Brad King
7 New Member
| is not a function. It is an operator. Wait, what exactly are you talking about?
You are correct, forgive my error. To begin with, the option you provided worked fantastic.

When researching the option you gave me I haven't found wiether or not the operator will choose a Character based on it's case(upper or lower).

Example: ^5\d*(a|d|e)\w+2001.

I understand this statement. I just don't understand if (a|d|e) will only pick up the lowercase or the uppercase. For my purposes i need it to be case specific.

I need it to distinguish between 3456 e 63rd st w
and 3456 E63rd St W


Am I clear now? Thank you again for your help.
Aug 17 '07 #5
sicarie
4,677 Recognized Expert Moderator Specialist
I'm pretty sure it is case sensitive, so you would be able to put (A|D|E) and it would only pick up the capital letters.

You can always create a small function to test it and have a sample that has both, see if they both get picked up or not.
Aug 17 '07 #6
Brad King
7 New Member
I'm pretty sure it is case sensitive, so you would be able to put (A|D|E) and it would only pick up the capital letters.

You can always create a small function to test it and have a sample that has both, see if they both get picked up or not.
I have to wait for my compiler but i am going to write out my idea in notepad today.

It will follow this Process.
1. Open data file for reading
2. Open update file for writing
3. for each record in the file is the record correct?
3.a Yes write it unchanged to the update file.
3.b no fix the record and write it to the update file
4. close data file
5. close update file.

if you don't mind giving it a look on Monday I will post it then. Thanks for all your help.
Aug 17 '07 #7

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

Similar topics

0
1774
by: Bob Kaku | last post by:
I'm trying to create a text editing and updating capability to help someone who wants to maintain content on a web page without having to know any HTML or use a web authoring tool and FTP'ng the...
4
3899
by: Jerry Khoo | last post by:
i am currently working on an assignment that requires the program to manage the files like editing file content, modifying file content, and deleting file contents. My question is what sort of...
10
1904
by: David T. Ashley | last post by:
Hi, I'd like to do some basic graphics. For example, if you look at: http://www.marshallaviationcenter.com the banner graphics at the top that apparently used an image editor with some...
12
3066
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
4
2534
by: Vanga Sasidhar | last post by:
Hi All, Please help me in the following problem. I am having some files with AVI extension. I want to make two programs in Visual Basic .NET which will work with these AVI Files. One program...
12
2800
by: Thomas Bartkus | last post by:
Does anyone use emacs together with both WordStar key bindings and python mode? I'm afraid that Wordstar editing key commands are burned R/O into my knuckles! I would like to play with emacs...
5
2477
by: Zytan | last post by:
I cannot stand being unable to change the code while the debugger is running. Is there a way to do this? thanks, Zytan
4
2326
by: ovatta | last post by:
Hi! I have meke a simple programs on c++ with visual studio. The program have a dll where I put my name e my personal details. I realize that anybody can take my executable file and with a simpli...
1
1106
by: artsylar | last post by:
i'm kinda new with C programming and i'm not good at it. I'm trying to make a program which involves file editing. first, a string must be searched inside the file. then edit the string in the file....
0
7134
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
7012
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
7180
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,...
1
6901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5479
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,...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1429
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.