1. Introduction. 1.1 In part 1 of this series of blogs we studied how to pass a managed structure (which contains strings) to unmanaged code. The structure was passed as an "in" (by-value) parameter, i.e. the structure was passed to the unmanage…
1. Introduction. 1.1 In part 1 of this series of blogs we studied how to pass a managed structure (which contains strings) to unmanaged code. The structure was passed as an "in" (by-value) parameter, i.e. the structure was passed to the unmanage…
1. Introduction. 1.1 Managed structures that contain strings are a common sight. The trouble is that managed strings are non-blittable. This means that they do not have a single common representation in the unmanaged world. However, there are several…
1. Introduction. 1.1 In parts 1 through 3 of this series of articles, I have thoroughly discussed the techniques for exchanging arrays between managed and unmanaged code by way of SAFEARRAYs. 1.2 The knowledge that can be gained from the first 3 part…
1. Introduction. 1.1 In part 1 of this series of articles, I demonstrated how to transfer managed arrays to unmanaged code as SAFEARRAYs. The transfer was single-directional "into" the unmanaged function and the SAFEARRAY that was passed to the…
1. Introduction. 1.1 I have previously written about exchanging SAFEARRAYs of managed structures with unmanaged code via COM interop. 1.2 In this new series of articles, I shall expound on the exchange of such SAFEARRAYs via P/Invoke. 1.3 I have arra…
1. Introduction. 1.1 Starting from part 4 I have started to discuss how to interop marshal a managed array of TestStructure structs that is contained within a structure. 1.2 We have seen in part 4 an example for marshaling such a container structure…
1. Introduction. 1.1 In part 4, I have started to discuss how to interop marshal a managed array that is contained within a structure. 1.2 I have given a specific working example for marshaling such a container structure to unmanaged code "one way&qu…
1. Introduction. 1.1 In part 1 of this series of articles, I explained how managed arrays may be transferred to unmanaged code as a SAFEARRAY. 1.2 In part 1, the SAFEARRAY was passed to unmanaged code as an "in" (read-only) parameter. 1.3 Here i…
# Fuking silly, OTZ.... import sys def main(): n = int(raw_input()) for num in sys.stdin: if int(num) % 2 == 0: print int(num) else: # 千万不要忘了考虑奇数的情况 print int(num) -1 main() 学习 化繁为简 逻辑上的理解正确和化繁为简,是刷OJ的第一步,比如本题,一堆废话,其实水爆 输入缓冲流 stdin这种输入就是缓冲流的使用 判断奇偶 模…