Err, you're trying to convert 4294967295
to 255.255.255.255, not the other way around? In that case, doesn't QBasic have bitwise AND and OR operators just like old Microsoft Basic?
Edit: Ahem, you receive "4294967295" as a string, and of course you can't apply VAL onto it because it is too large to represent as an integer. Then you probably would need ASCII subtraction, starting with subtracting "2147483648" from the incoming string, and output four groups of numbers based on if you were able to subtract the whole value or not. Interesting exercise, maybe I'll see if I can do it tomorrow.
Anyway, I wrote a program in Commodore Basic (a.k.a. Microsoft Basic) to convert from an IP number to a long integer. Perhaps it is not fully optimized, but have fun:
Code:
10 INPUT"IP";A$:D=1:I=1:R$="":O$="":OC=0:DIMC(4)
11 C(D)=0:B$=""
12 B$=MID$(A$,I,1):IFI<=LEN(A$)THENI=I+1:IFB$<>"."THENC(D)=C(D)*10+VAL(B$):GOTO12
13 IFD<4THEND=D+1:GOTO11
14 U$=STR$(C(1)*2097152):L$=STR$(C(2)*65536+C(3)*256+C(4))
16 L$=RIGHT$("000000000"+RIGHT$(L$,LEN(L$)-1),10)
17 FORI=LEN(U$)TO1STEP-1:X=VAL(MID$(U$,I,1))*8:C=INT(X/10):L=X-C*10
18 L=L+OC:OC=0:IFL>9THENOC=INT(L/10):L=L-10
19 R$=CHR$(L+48)+R$:OC=OC+C:NEXT
20 R$=RIGHT$("000000000"+R$,10):C=0
21 FORI=LEN(R$)TO1STEP-1:L=VAL(MID$(R$,I,1))+VAL(MID$(L$,I,1))+C
22 C=0:IFL>9THENC=1:L=L-10
23 O$=CHR$(L+48)+O$:NEXT
24 PRINT O$
Some comments: STR$ outputs a leading space when it converts a number to a string, at least on the Commodore. Therefore all the junk with RIGHT$(string,LEN(string)-1) to remove it. The junk with a lot of zeroes is to pad out the strings so they have the maximum length of 10 digits. It is not really required, but instead of a lot of IF statements whichever string is longer than the other, I thought both can be padded.
It would be possible to use ASC instead of VAL in some places, but one would have to subtract the ASCII value for "0" which is 48 in any case, so no gain from there. Needless to say it is dog slow on a 8-bit Commodore. It takes between 50 to 70 clock pulses, i.e. around one second depending on how difficult the IP number is to convert.