Getting the ASCII value of escape sequence character from 2 chars [on hold]











up vote
-3
down vote

favorite












I'm reading chars from a file and whenever I read a char with value of 092 that is '' I want to read this char and the next char as one and get their ascii value, is that possible?



e.g. if I read '' and the next char is 'n' I want to be able to get the value 010.



I'm getting chars in while using a while cycle and char c = fgetc(source).










share|improve this question







New contributor




Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as too broad by hyde, Jean-François Fabre, Govind Parmar, Broman, OldProgrammer Nov 21 at 20:04


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    of course that's possible. By storing the fact that you encountered and a switch/case on the next char read.
    – Jean-François Fabre
    Nov 21 at 20:00






  • 1




    Yes, it is possible. Many ways to do it. You should try something first, snd then askfor help with that, when you run into an actual problem. One way to go about this would be to have variable for current and previous char, and play with them. Another could be to just have a bool flag telling if previous char was your escape char . Or something else.
    – hyde
    Nov 21 at 20:01










  • Give it a try and if you don't get it working, then show your code, what you have tried and what does not (yet) work correctly. (Minimal, Complete, and Verifiable example)
    – Werner Henze
    Nov 21 at 20:07










  • In C, 92 is not the character back-slash (ASCII 92). digit begins an octal-escape-sequence, not decimal. You need to post the code you have used - next time, rather than only describe the problem.
    – chux
    Nov 21 at 22:04












  • n is used in some programming languages and some types of configuration files and some types of documents (e.g. JSON). Are you writing a lexer? Surely there is one already for whatever type of file you are reading. You also need a complete list of the escapes you want to support.
    – Tom Blodget
    Nov 22 at 0:57

















up vote
-3
down vote

favorite












I'm reading chars from a file and whenever I read a char with value of 092 that is '' I want to read this char and the next char as one and get their ascii value, is that possible?



e.g. if I read '' and the next char is 'n' I want to be able to get the value 010.



I'm getting chars in while using a while cycle and char c = fgetc(source).










share|improve this question







New contributor




Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as too broad by hyde, Jean-François Fabre, Govind Parmar, Broman, OldProgrammer Nov 21 at 20:04


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    of course that's possible. By storing the fact that you encountered and a switch/case on the next char read.
    – Jean-François Fabre
    Nov 21 at 20:00






  • 1




    Yes, it is possible. Many ways to do it. You should try something first, snd then askfor help with that, when you run into an actual problem. One way to go about this would be to have variable for current and previous char, and play with them. Another could be to just have a bool flag telling if previous char was your escape char . Or something else.
    – hyde
    Nov 21 at 20:01










  • Give it a try and if you don't get it working, then show your code, what you have tried and what does not (yet) work correctly. (Minimal, Complete, and Verifiable example)
    – Werner Henze
    Nov 21 at 20:07










  • In C, 92 is not the character back-slash (ASCII 92). digit begins an octal-escape-sequence, not decimal. You need to post the code you have used - next time, rather than only describe the problem.
    – chux
    Nov 21 at 22:04












  • n is used in some programming languages and some types of configuration files and some types of documents (e.g. JSON). Are you writing a lexer? Surely there is one already for whatever type of file you are reading. You also need a complete list of the escapes you want to support.
    – Tom Blodget
    Nov 22 at 0:57















up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











I'm reading chars from a file and whenever I read a char with value of 092 that is '' I want to read this char and the next char as one and get their ascii value, is that possible?



e.g. if I read '' and the next char is 'n' I want to be able to get the value 010.



I'm getting chars in while using a while cycle and char c = fgetc(source).










share|improve this question







New contributor




Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm reading chars from a file and whenever I read a char with value of 092 that is '' I want to read this char and the next char as one and get their ascii value, is that possible?



e.g. if I read '' and the next char is 'n' I want to be able to get the value 010.



I'm getting chars in while using a while cycle and char c = fgetc(source).







c






share|improve this question







New contributor




Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 21 at 19:55









Jan Vaculik

1




1




New contributor




Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Jan Vaculik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as too broad by hyde, Jean-François Fabre, Govind Parmar, Broman, OldProgrammer Nov 21 at 20:04


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






put on hold as too broad by hyde, Jean-François Fabre, Govind Parmar, Broman, OldProgrammer Nov 21 at 20:04


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    of course that's possible. By storing the fact that you encountered and a switch/case on the next char read.
    – Jean-François Fabre
    Nov 21 at 20:00






  • 1




    Yes, it is possible. Many ways to do it. You should try something first, snd then askfor help with that, when you run into an actual problem. One way to go about this would be to have variable for current and previous char, and play with them. Another could be to just have a bool flag telling if previous char was your escape char . Or something else.
    – hyde
    Nov 21 at 20:01










  • Give it a try and if you don't get it working, then show your code, what you have tried and what does not (yet) work correctly. (Minimal, Complete, and Verifiable example)
    – Werner Henze
    Nov 21 at 20:07










  • In C, 92 is not the character back-slash (ASCII 92). digit begins an octal-escape-sequence, not decimal. You need to post the code you have used - next time, rather than only describe the problem.
    – chux
    Nov 21 at 22:04












  • n is used in some programming languages and some types of configuration files and some types of documents (e.g. JSON). Are you writing a lexer? Surely there is one already for whatever type of file you are reading. You also need a complete list of the escapes you want to support.
    – Tom Blodget
    Nov 22 at 0:57
















  • 1




    of course that's possible. By storing the fact that you encountered and a switch/case on the next char read.
    – Jean-François Fabre
    Nov 21 at 20:00






  • 1




    Yes, it is possible. Many ways to do it. You should try something first, snd then askfor help with that, when you run into an actual problem. One way to go about this would be to have variable for current and previous char, and play with them. Another could be to just have a bool flag telling if previous char was your escape char . Or something else.
    – hyde
    Nov 21 at 20:01










  • Give it a try and if you don't get it working, then show your code, what you have tried and what does not (yet) work correctly. (Minimal, Complete, and Verifiable example)
    – Werner Henze
    Nov 21 at 20:07










  • In C, 92 is not the character back-slash (ASCII 92). digit begins an octal-escape-sequence, not decimal. You need to post the code you have used - next time, rather than only describe the problem.
    – chux
    Nov 21 at 22:04












  • n is used in some programming languages and some types of configuration files and some types of documents (e.g. JSON). Are you writing a lexer? Surely there is one already for whatever type of file you are reading. You also need a complete list of the escapes you want to support.
    – Tom Blodget
    Nov 22 at 0:57










1




1




of course that's possible. By storing the fact that you encountered and a switch/case on the next char read.
– Jean-François Fabre
Nov 21 at 20:00




of course that's possible. By storing the fact that you encountered and a switch/case on the next char read.
– Jean-François Fabre
Nov 21 at 20:00




1




1




Yes, it is possible. Many ways to do it. You should try something first, snd then askfor help with that, when you run into an actual problem. One way to go about this would be to have variable for current and previous char, and play with them. Another could be to just have a bool flag telling if previous char was your escape char . Or something else.
– hyde
Nov 21 at 20:01




Yes, it is possible. Many ways to do it. You should try something first, snd then askfor help with that, when you run into an actual problem. One way to go about this would be to have variable for current and previous char, and play with them. Another could be to just have a bool flag telling if previous char was your escape char . Or something else.
– hyde
Nov 21 at 20:01












Give it a try and if you don't get it working, then show your code, what you have tried and what does not (yet) work correctly. (Minimal, Complete, and Verifiable example)
– Werner Henze
Nov 21 at 20:07




Give it a try and if you don't get it working, then show your code, what you have tried and what does not (yet) work correctly. (Minimal, Complete, and Verifiable example)
– Werner Henze
Nov 21 at 20:07












In C, 92 is not the character back-slash (ASCII 92). digit begins an octal-escape-sequence, not decimal. You need to post the code you have used - next time, rather than only describe the problem.
– chux
Nov 21 at 22:04






In C, 92 is not the character back-slash (ASCII 92). digit begins an octal-escape-sequence, not decimal. You need to post the code you have used - next time, rather than only describe the problem.
– chux
Nov 21 at 22:04














n is used in some programming languages and some types of configuration files and some types of documents (e.g. JSON). Are you writing a lexer? Surely there is one already for whatever type of file you are reading. You also need a complete list of the escapes you want to support.
– Tom Blodget
Nov 22 at 0:57






n is used in some programming languages and some types of configuration files and some types of documents (e.g. JSON). Are you writing a lexer? Surely there is one already for whatever type of file you are reading. You also need a complete list of the escapes you want to support.
– Tom Blodget
Nov 22 at 0:57



















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

How to ignore python UserWarning in pytest?

Alexandru Averescu