CodePudding user response:
The file is already exists in the disk fileCodePudding user response:
Whatever files, in the end is not "binary"!!!!!!DOS command:
Ren *. TXT *. Dat
CodePudding user response:
Dim (d) As Byte
D="hello" & amp; VbCrLf & amp; Now & amp; VbCrLf & amp; "Not happy today"
Open "c: \ Binary test. TXT" For Binary As # 1
Put # 1, d
Close # 1
Test and see, oh I don't know how to read
CodePudding user response:
For reference only, although not VB6:# include & lt; stdio.h>
# include & lt; String. H>
# include & lt; Conio. H>
The FILE * fi * fo;
Int r;
Unsigned int n, c;
Long offset.
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void main (int arg c, char * argv [])
{
If (argc<3) {
Cprintf (" Hex2Bin srcfile desfile ");
return;
}
If ((fi=fopen (argv [1], "rb"))==NULL) {
Cprintf (" Can not find the file % s ", argv [1]).
return;
}
If ((fo=fopen (argv [2], "wb"))==NULL) {
The fclose (fi);
Cprintf (" Can not create the file % s ", argv [2]).
return;
}
N=0;
While (1) {
Offset=ftell (fi);
R=fscanf (fi, "% 2 x", & amp; C);
If (EOF==r) break;//
If (1==r) {
Fputc (c, fo);
N++;
} else {//0==r
Fseek (fi, offset, SEEK_SET);//for VC6 Release version and the VC7, 8,9,10,... Version of the fscanf not offset unchanged by the agreement, so I must restore offset
R=fgetc (fi);
If (EOF==r) break;//
}
}
Fcloseall ();
Cprintf (" OK to Hex2Bin % d bytes. The ", n);
}