search for: con_in

Displaying 2 results from an estimated 2 matches for "con_in".

2024 May 21
1
wrtiteBin in conjunction with seek : the position in the file is not good when writing
...e tiny example: The file_test.txt before: 1234567890 1234567890 The file_test.txt after: ?AA AA7890 1234567890 The file should have been like that: 123456 AA AA1234567890 ## open the file in read/write mode + binary fname <- file.path(".","txt","file_test.txt") con_in <- file(fname,"r+b") # move on 2 bytes pos <- seek(con_in,2,origin="start") # We have to repeat the command to return the good amount of read bytes print(paste0("pos is not equal to 2, pos = ",pos)) pos <- seek(con_in,2,origin="start") print(paste0(&...
2024 May 21
1
wrtiteBin in conjunction with seek : the position in the file is not good when writing
? Tue, 21 May 2024 11:29:33 +0200 Laurent Rhelp <laurentRHelp at free.fr> ?????: > pos <- seek(con_in,2,origin="start") > # We have to repeat the command to return the good amount of read > # bytes > print(paste0("pos is not equal to 2, pos = ",pos)) That's because seek() returns the previous position ("before any move", the one that the help page calls &...