Hello, I am new to c++ and honestly never use it, but I need to write a little script that takes that contents of a file and stores it into a variable.
With that variable(string) I need to create 2 more variables with a substring command. Then I need to write those 2 variabless to the lpt1 printer port.
I currently have this
#include <stdio.h>
void main(void)
{
FILE *fp;
char ch;
fp = fopen("test.txt","r"
ch = getc(fp);
while(ch!=EOF)
{
putchar(ch);
ch = getc(fp);
}
}
but not sure how to get a substring out of the variable.
I am trying to get out characters 16-24 and 34-52 out of the variable and store them into 2 speperate variable and then write those 2 variable to the lpt1 printer port. I hope this makes sense.
With that variable(string) I need to create 2 more variables with a substring command. Then I need to write those 2 variabless to the lpt1 printer port.
I currently have this
#include <stdio.h>
void main(void)
{
FILE *fp;
char ch;
fp = fopen("test.txt","r"
ch = getc(fp);
while(ch!=EOF)
{
putchar(ch);
ch = getc(fp);
}
}
but not sure how to get a substring out of the variable.
I am trying to get out characters 16-24 and 34-52 out of the variable and store them into 2 speperate variable and then write those 2 variable to the lpt1 printer port. I hope this makes sense.