• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. how to handle illegal characters when reading a file

Stats

  • Replies 5
  • Subscribers 161
  • Views 13925
  • Members are here 0
More Content

how to handle illegal characters when reading a file

Ejlersen
Ejlersen over 13 years ago

Hi

I've got a problem when I read in a file, I use gets(nextline inputfile) but one of the lines that I read contain the following

"netname '«USB_WR«'"

So I will get an error when reading this line and cannot continue any work and extract the USB_WR part that interests me

Do you see any way around this? Using lineread does not change this

Best regards

Ole

  • Sign in to reply
  • Cancel
  • Randy R
    Randy R over 13 years ago

    You could try something like this:

    in_char = symbolToString(getc(in_port)) ; to import one character at a time

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Ejlersen
    Ejlersen over 13 years ago

    Hi Randy

    Thanks for the suggestion, I did notice this as an option but my problem is that the file I'm passing is more than 40k lines and the end program will need to be able to pass even bigger files.

    So I'm a bit concerned about performance, even with gets/lineread it takes a good amount of time to read and process the file.

    It would be good to be able to readin the line and then handle the data before getting an error. I'm not applying anything to the database so far, I would understand the message if I was trying to create a net or something using illegal characters.

    Again, thanks for the tip.

    Best regards

    Ole

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Randy R
    Randy R over 13 years ago

    One other method; pre-parse the file to remove the illegal characters; possibly using a text editor, a PERL program, etc...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • aCraig
    aCraig over 13 years ago

    Hi Ole,

    Have you tried saving the file as UTF-8 or running it through a UTF-8 decoder?

     Craig

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Ejlersen
    Ejlersen over 13 years ago

    Hi

    I'll have to look into this, thanks very much for the suggestion.

    Best regards

    Ole

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information