Thread Line encoding (13 answers)
Opened by Graf Herschel at 2015-02-16 15:15

Gast Graf Herschel
 2015-02-16 20:24
#179697 #179697
Vielen Dank für deine Unterstützung
String::Escape ist das passende module

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
use String::Escape qw(unbackslash);

if(open(my $fh,"<","template_file"))
{
        while(<$fh>)
        {
                next if(/^$/ || /^#/);
                chomp $_;
                $bu=unbackslash($_);
                print("$bu\n");
        }
        close($fh);
}


Zu meiner C Behauptung von weiter unten.
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
tmpl=(char*)malloc(512);
int f=fopen("template_file","r");
u_int row=0;
for(int i=0;i<4000;i++)
tmpl[i]=' ';

row=0;
while(1)
{
fscanf(f,"%[^\n]",line); // dass ist es, das ich vergessen hatte
i=fscanf(f,"%c",&i); // und hier
if (i<1) break;
memcpy(tmpl+row*80,line,80);
row++;
}
fclose(f);


Nocheinmal danke und einen schönen Gruß
Last edited: 2015-02-16 20:25:53 +0100 (CET)

View full thread Line encoding