Help me write a scanner (of a compiler) in c++ - Mustang Evolution

Go Back   Mustang Evolution > Off Topic Forums > The Bar



Reply
 
Thread Tools Search this Thread
Please support our sponsors and let them know you heard about them here!
Old 02-16-2005, 06:43 PM   #1
Moderator Emeritus
Legacy
Regular
 
SpectorV's Avatar
 
Join Date: May 2003
Region: Alabama
Posts: 26,049
Send a message via AIM to SpectorV
Help me write a scanner (of a compiler) in c++

i cant get a stupid getline string class function to work... its got a but in it from MS imagine that.....

is there another way to read an entire line or XX items and store htem into a string wiht out worrying about the extra garbage you get from the mess up with the get line function.

i try :

getline(inputsource, string);

and inputsource.getline(character array, size to read in)

neither work right....
__________________
2003 Cobra Vert (Redfire) #3938 of 5082 @ 05/27/2003
472rwhp/493rwtq -Modification List - Dyno Sheet
2012 Mustang 3.7L M6 (Kona Blue)
2011 Ford Edge Sport (Red Metallic)
SpectorV is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 02-16-2005, 07:04 PM   #2
Legacy Member
Legacy
 
meteorachick's Avatar
 
Join Date: Jan 2005
Region: New Jersey
Posts: 2,347
Send a message via AIM to meteorachick
my really good friend knows c++ and I showed him that...he said he would prolly know the answer if he knew what OS and compiler ur using....

so let me know and i'll relay the info to him
__________________
In God We Trust. All Others Checked NCIC.

Modified 2004 V6
meteorachick is offline   Reply With Quote
Old 02-16-2005, 07:07 PM   #3
Legacy Member
Legacy
 
meteorachick's Avatar
 
Join Date: Jan 2005
Region: New Jersey
Posts: 2,347
Send a message via AIM to meteorachick
oh he said to try cin.getline (variable,256); name and byte length are whatever u need
__________________
In God We Trust. All Others Checked NCIC.

Modified 2004 V6
meteorachick is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 02-16-2005, 07:39 PM   #4
Moderator Emeritus
Legacy
Regular
 
SpectorV's Avatar
 
Join Date: May 2003
Region: Alabama
Posts: 26,049
Send a message via AIM to SpectorV
i tried that, its still doing the same problem, im using Microsoft visual 6.0 professional c++

what i am having issues with is the following....

I am getting an entire line from a text file, I am thing breaking the string up letter by letter with...

string.substr(start position, end position)
// end pos is 1 in this case to just get a single letter.

im storing this letter into a buffer or what not and adding each new character to this buffer as well, so i am building a word.

then when i find a given letter such as a ; or a : or a = sign i stop building my word and i will have a complete word in my buffer.

the problem is when i read the very last word on a line when there is NOTHING after the last letter it will take that word i just built and not treat it properly.

every time i find a complete word i print it to a file with the line it was found on, the last word in a line wiht nothing after the word shows up as comming from the next line.... i increment my line counter at the very bottom of my loop so it has no link to this... its just an issue with getline i belive.

if i add a space or a ; or a : or any of my special characters after the last letter in the word it works perfectly, its only when there is Nothing after the last letter in the last word on the line i have issues.
__________________
2003 Cobra Vert (Redfire) #3938 of 5082 @ 05/27/2003
472rwhp/493rwtq -Modification List - Dyno Sheet
2012 Mustang 3.7L M6 (Kona Blue)
2011 Ford Edge Sport (Red Metallic)
SpectorV is offline   Reply With Quote
Old 02-16-2005, 07:47 PM   #5
Legacy Member
Legacy
 
meteorachick's Avatar
 
Join Date: Jan 2005
Region: New Jersey
Posts: 2,347
Send a message via AIM to meteorachick
okay this is what he said:

him: MSVC++ 6 has an issue with the getline function
him: he could set his character to check for to be the newline character
him: beyond that
him: i hate C++


so sorry if this doesn't help, but i did my best (well rather, my friend did his best, i know nothing about c++)
__________________
In God We Trust. All Others Checked NCIC.

Modified 2004 V6
meteorachick is offline   Reply With Quote
Old 02-16-2005, 11:33 PM   #6
Moderator Emeritus
Legacy
Regular
 
SpectorV's Avatar
 
Join Date: May 2003
Region: Alabama
Posts: 26,049
Send a message via AIM to SpectorV
lol I have done assembly, ada, fortran, pascal, java, javascripe, etc... they all suck in their own way...

I just added a space to the end to fix the issue...... this would have never happend in a non MS compiler... i have no choice it has to compile in ms and run...
__________________
2003 Cobra Vert (Redfire) #3938 of 5082 @ 05/27/2003
472rwhp/493rwtq -Modification List - Dyno Sheet
2012 Mustang 3.7L M6 (Kona Blue)
2011 Ford Edge Sport (Red Metallic)
SpectorV is offline   Reply With Quote
Reply

Lower Navigation
Go Back   Mustang Evolution > Off Topic Forums > The Bar

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matco Pro Scan plus, scanner Otlaw80 Mustang Parts for Sale and Wanted 8 07-23-2009 11:19 AM
How to write good n8r The Bar 7 12-23-2006 11:38 PM
Need A Write-Up MyStangStanks Pre-2005 V6 Mustang 10 11-20-2006 01:06 PM
What is the best Virus Scanner? Kiljosh The Bar 22 05-18-2006 10:10 AM
NYC Police scanner n8r The Bar 5 06-20-2004 10:28 PM

» Like Us On Facebook



05:45 PM


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0

MustangEvolution.com is in no way associated with or endorsed by Ford Motor Company.