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

how do i read words like "can't" using getline and keep the apostrophe?

I have a text file that I'm trying to parse with ifstream getline function. The problem is that I have to recognize single quotes in the middle of words as well as on the end of words.

the first line of inputFile.txt is:
'In''''put 'directory: sample/
Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3.     char str[4096];
  4.     ifstream inFile;
  5.     inFile.open("inputFile.txt");
  6.     inFile.getline(str, 4096);
  7.     cout << str << endl;
  8.     inFile.close("inputFile.txt")    
  9.     return 0;
  10. }
  11.  
Getline automatically throws out the single quotes but I don't want it to:
Oct 9 '10 #1
1 1790
newb16
687 512MB
Given that ifstream::close doesn't accept string and there must be semicolon after function call, I guess the program doesn't even compile. An no, it doesn't remove quotes.
Oct 9 '10 #2

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

Similar topics

235
by: napi | last post by:
I think you would agree with me that a C compiler that directly produces Java Byte Code to be run on any JVM is something that is missing to software programmers so far. With such a tool one could...
2
by: John Baker | last post by:
Hi: I have a report that contains a remarks field which is a "memo" format field. I have that field on a single line in the report, and have it given a property of "Can Shrink", in the hope that...
13
by: baumann.Pan | last post by:
when define char *p = " can not modify"; p ='b' ;is not allowed, but if you declare p as char p = "can modify"; p = 'b'; is ok? why?
2
by: Gustavo De la Espriella | last post by:
Hi, I know this is not a Crystal Reports group, but news.cogniza.com recieves like one question per week. Does anyone know how to push fields following a textbox when it grows with the "Can...
1
by: welles.lo | last post by:
Hi all, I found that the default "can grow" in Crystal Reports 10 is different from the one in Crystal Report 9. In version 9, when "can grow" is disable, the words in the field are chopped...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
2
by: steve456 | last post by:
Is it possible in a form while entering data in a text field to get the field to drop down so as to see all of what you're typing. I know this option is available in a Report but haven't come...
2
by: Seanw | last post by:
i created a report in access. the output look like spreedsheet(every field has solid border) there is one colunm have some fields have very long content. so i set all colunms to "can grow" but in...
7
by: php_mysql_beginer911 | last post by:
Hi .. hope someone will help i am trying to figure it out why i cannot post string "union select" every time i try to post data which content union and select .. the page doesn't get posted and...
2
by: evildracko | last post by:
Hi, since last time I have still note been able to solve this one, im starting to get frustrated, does anyone know if there is a way to force a page break on a sub report instead of the can grow...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.