473,581 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String Search Woes Continue

I am trying to find if a string exists in a file. If it doesn’t, it should return a “-1” and I’ll make my decision based on that

Here is a sniplet of the text file

game
name mapp
description "Mappy (US)
year 198
manufacturer "Namco
history "\nMappy (c) 03/1983 Namco. \n\n- TRIVIA: \n\nLicensed to Bally Midway for US manufacture and distribution. (03/1983) \n\n- SERIES: \n\n1. Mappy \n2. Hopping Mappy \n\n0.26 [Aaron Giles, Mirko Buffoni] \n\nBugs: \n- \"000\" is displayed on the highscore. If you get more than 30000 pts, it is displayed normally. This happens whether there are \"hiscore.dat\" , hi file and cfg file or not. mappy37b4gre Fujix \n- In Mappy (both versions, mappy and mappyjp), if you insert at least 2 credits, start a 1-player game, and then press 1-player Start any time during the game action (including the beginning intro), a new 1-player game is started. mappy37b8gre The tECHIDNA V \n\nWIP: \n- 0.59: Rename zip (mappyjp) to (mappyj). \n- 28th June 1999: Manuel Abadia fixed the custom IO chip reset bugs in the Mappy driver. \n- 0.29: Aaron Giles made some Video drawing optimization to Mappy, plus test mode now works both in Mappy and Dig Dug 2. \n- 0.27: Aaron Giles did a major rewrite of his Super Pac man and Mappy drivers: - support for Dig Dug 2 and Pac & Pal - High score save in all games - 100% colors and sound samples (in Super Pac man the siren clicks a bit, but neither I nor jrok can figure it out; the sample data *is* correct) - better sound playback frequency (was missing some high bits!) - arcade accurate frequency calculation (thanks to jrok!) - removed all palette hacks; everything is clean - added loop optimizations for speed - video now properly displayed, including high priority characters \n- 0.26a: Super Pac Man and Mappy have correct pitch now (thanks Aaron and Satoh). \n- 0.26: Added support for Mappy. Aaron Giles also added sound support and very close arcade colors. \n\nOther Emulators: \n* HiVE \n* Retrocade \n\nRecommended Games: \nMappy - Namco Classics Vol.1 (Original/Arrangement) \nHopping Mappy \nCheeky Mouse \nMouse Trap \nMacho Mouse \nFunny Mouse \nMouser \n\nCategory: Platform \n\nRecommended Games (2): \nMappy - Namco Classics Vol.1 (Original/Arrangement) \nSpace Panic \nDonkey Kong \nCrazy Kong \nDonkey Kong Junior \nDonkey Kong 3 \nLogger \nFrogger \nKangaroo \nPonpoko \nSpringer \nArabian \nCongo Bongo \nDr. Micro \nHopper Robo \nJump Coaster \nMouser \nRoc'n Rope \nSuper Glob \nFlicky \nIce Climber \nIce Climber Dual \nJumping Jack \nLode Runner \nLode Runner II - The Bungeling Strikes Back \nLode Runner III - Majin No Fukkatsu \nLode Runner IV - Teikoku Karano Dasshutsu \nLode Runner - The Dig Fight \nPandora's Palace \nPeter Pack-Rat \nSon Son \nVs. Wrecking Crew \nBaluba-louk no Densetsu \nPsychic 5 \n\nRomset: 53 kb / 11 files / 27.7 zip \n
rom ( name mp1-6.4c size 256 crc 50765082 sha1 f578e14f15783ac b2073644db4a2f0 d196cc0957 region proms offs 20
rom ( name mp1-7.5k size 256 crc 5396bd78 sha1 2e387e5d8b8cab0 05f67f821b4db65 d0ae8bd362 region proms offs 120
rom ( name mp1-3.3m size 256 crc 16a9166a sha1 847cbaf7c886165 76c410177e066ae 1d792ac0ba region sound1 offs 0
chip ( type cpu name M6809 clock 1536000
chip ( type cpu name M6809 clock 1536000
chip ( type audio name Namco_15XX
video ( screen raster orientation vertical x 224 y 288 aspectx 3 aspecty 4 freq 60.606060
sound ( channels 1
input ( players 2 control joy8way buttons 1 coins 2
dipswitch ( name "Cabinet" entry "Upright" default "Upright" entry "Cocktail"
dipswitch ( name "Service Mode"
dipswitch ( name "Difficulty " entry "Rank A" default "Rank A" entry "Rank B" entry "Rank C" entry "Rank D" entry "Rank E" entry "Rank F" entry "Rank G" entry "Rank H"
driver ( status good color good sound good palettesize 32
Bear in mind that this is only one section. There are about 2700 of these sections in the file. It’s about 26MB in size

In this example I want to search for the string “name mappy”. After that I want to go to the line that begins with “video”, “video ( screen raster orientation vertical x 224 y 288 aspectx 3”. Then after I find that line I want to see if either the string “vertical” or “horizontal exist on that line. I will then create my logic based on which string exists. There may be some sort of character that begins the “name mappy” and “video” lines. When I open the file in Wordpad is seems like there is a TAB there

I have tried working with the streamreader for about 6 or 8 hours. I just can’t seem to get it quite right.

Help me out here guys,
John

Nov 20 '05 #1
3 1278
"jcouse" <an*******@disc ussions.microso ft.com> schrieb
I am trying to find if a string exists in a file. If it doesn’t, it
should return a “-1” and I’ll make my decision based on that.

Here is a sniplet of the text file:

[...]

I have tried working with the streamreader for about 6 or 8 hours. I
just can’t seem to get it quite right.


I'd get the documentation of the file format, then write a parser to analyze
the file, then examine the analyze result to get the information you need.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
* =?Utf-8?B?amNvdXNl?= <an*******@disc ussions.microso ft.com> scripsit:
[...]

Is there any reason why you don't stay in the original thread?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
It was 2 or 3 pages down and I was afraid it would \n't get seen. I'm not sure what type of front end you MVP's are using to read the posts and just didn't know if it would get spotted. I apologize if I have broken any forum rules or etiquette.

Sorry,
John
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1710
by: Mark | last post by:
O, woe is me, to have seen what I have seen, see what I see! (That's Shakespeare for those who were wondering what I'm on about) I am "having fun" with cookies. And I wonder if I have missed something obvious.
18
2499
by: jblazi | last post by:
I should like to search certain characters in a string and when they are found, I want to replace other characters in other strings that are at the same position (for a very simply mastermind game) for my pupils. This very simple thing does not seem simple at all. If I use strings, I cannot replace their parts (though I can use...
9
1847
by: zjut | last post by:
I want to add a string to the file and the file is sort by letter! for examply: the follow file is a big file ////////////////////// abort black cabbage dog egg fly
0
1208
by: Brian Young | last post by:
My department is responsible for creating custom internal applications for many of our departments. Our strategy has always been to develop our applications as ActiveX controls (VB6) that get hosted in Internet Explorer. I've been tasked with coming up with a strategy for our migration to using VB.Net. So far, I've experienced a number of...
3
1536
by: Jim Britain | last post by:
I know absolutely nothing about Python. My background is shell scripts assembly language and C programming. Currently I work network support. This is a portion of a Python script written by aaronsinclair. the full script can be found at: http://forums.ev1servers.net/printthread.php?t=50435&page=3&pp=25 It monitors sendmail logfiles...
2
2267
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled.
1
1302
by: Simon D | last post by:
I've managed to create a desktop app (in vs2005) using .net that accesses a web service. However porting to the compact framework is a failure, because the response(s) to the proxy class calls are not constructed properly. The service uses a session token that is in a member object of the returned structure. wsdl.exe makes this object a...
4
2787
by: sandvet03 | last post by:
I am trying to expand on a earlier program for counting subs and now i am trying to replace substrings within a given string. For example if the main string was "The cat in the hat" i am trying to find a chosen substring lets say "cat" and then replace it with a difrent inputed substring say "dog". Tried to get as far as i could on my own but...
14
2962
by: S | last post by:
Any idea on how I would be able to do a search within C# that does ranges or words For example I want to search for Chicken in the string string s1 = "This is Great Chicken";
0
7868
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
8304
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8175
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5674
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5364
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1403
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1138
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.