Response to Remote access to Unet Agents for GNURadio - unetstack

I was wondering what did the Unetstack agent expect as a response to a TCP connection which is established to the modem at ip:port ?
I was trying to connect to the the modem using the TCP connection through the GNURadio pdu socket. The connection was established but i think after handshaking, it was automatically terminated. Did it expect something ?I am planning to send custom messages to modem using this APIs.
Here is what i have done so far.
I opened a TCP connection using Socket PDU block using below flow graph.
I used unet audio SDOAM to test:
jay#jay-MS-7885:~/Desktop/unet-3.2.0$ bin/unet -c audio
Modem web: http://localhost:8080/
> iface
tcp://10.0.3.1:1100, tcp://192.168.0.14:1100, tcp://192.168.0.165:1100 [API]
ws://10.0.3.1:8080/ws, ws://192.168.0.14:8080/ws, ws://192.168.0.165:8080/ws [API]
unetsh: console://- [GroovyScriptEngine]
websh: ws://127.0.1.1:8080/fjage/shell/ws [GroovyScriptEngine]
It looks like the connection was established and on GNURadio side in command prompt i got normal JSON response from modem. And Just after that connection was automatically closed. Did it expect something ?
Executing: /usr/bin/python3 -u /home/jay/Desktop/Jay/UnetstackPython.py
******* MESSAGE DEBUG PRINT ********
Send
************************************
******* MESSAGE DEBUG PRINT ********
(() . #[{ " a l i v e " : t r u e }
])
************************************
******* MESSAGE DEBUG PRINT ********
(() . #[{ " a c t i o n " : " s e n d " , " m e s s a g e " : { " c l a z z " : " o r g . a r l . f j a g e . G e n e r i c M e s s a g e " , " d a t a " : { " m s g I D " : " 0 9 f 5 3 2 0 0 - e 2 9 1 - 4 8 2 6 - 8 9 6 b - c 5 d 1 6 5 8 9 f 8 d 5 " , " i n R e p l y T o " : " 3 5 5 8 f e c 9 4 e e 7 b e e 1 a 5 0 f 5 6 6 1 d e 6 f c 4 b d " , " p e r f " : " A G R E E " , " r e c i p i e n t " : " W e b G W - c e a 1 9 a 9 d 3 7 f b e b 0 8 " , " s e n d e r " : " w e b s h " , " a n s " : " a u t o " } } , " r e l a y " : f a l s e }
])
************************************
******* MESSAGE DEBUG PRINT ********
(() . #[{ " a c t i o n " : " s e n d " , " m e s s a g e " : { " c l a z z " : " o r g . a r l . f j a g e . G e n e r i c M e s s a g e " , " d a t a " : { " m s g I D " : " 4 b d 5 6 f 0 7 - d a c 2 - 4 7 2 9 - 8 2 7 6 - b 4 4 1 8 6 d 3 1 6 a a " , " i n R e p l y T o " : " 8 7 7 9 5 2 4 c 4 5 d 8 9 f 1 e 4 6 3 b e 9 8 e 6 4 d 6 0 c e a " , " p e r f " : " A G R E E " , " r e c i p i e n t " : " W e b G W - c e a 1 9 a 9 d 3 7 f b e b 0 8 " , " s e n d e r " : " w e b s h " , " a n s " : " t c p : / / 1 0 . 0 . 3 . 1 : 1 1 0 0 , t c p : / / 1 9 2 . 1 6 8 . 0 . 1 4 : 1 1 0 0 , t c p : / / 1 9 2 . 1 6 8 . 0 . 1 6 5 : 1 1 0 0 [ A P I ] \ n w s : / / 1 0 . 0 . 3 . 1 : 8 0 8 0 / w s , w s : / / 1 9 2 . 1 6 8 . 0 . 1 4 : 8 0 8 0 / w s , w s : / / 1 9 2 . 1 6 8 . 0 . 1 6 5 : 8 0 8 0 / w s [ A P I ] \ n t c p : / / / 1 0 . 0 . 3 . 1 : 1 1 0 0 / / 1 0 . 0 . 3 . 1 . 3 5 9 5 6 [ A P I ] \ n u n e t s h : c o n s o l e : / / - [ G r o o v y S c r i p t E n g i n e ] \ n w e b s h : w s : / / 1 2 7 . 0 . 1 . 1 : 8 0 8 0 / f j a g e / s h e l l / w s [ G r o o v y S c r i p t E n g i n e ] " } } , " r e l a y " : f a l s e }
])
************************************
******* MESSAGE DEBUG PRINT ********
(() . #[{ " a c t i o n " : " s e n d " , " m e s s a g e " : { " c l a z z " : " o r g . a r l . f j a g e . p a r a m . P a r a m e t e r R s p " , " d a t a " : { " i n d e x " : - 1 , " v a l u e s " : n u l l , " p a r a m " : " o r g . a r l . y o d a . M o d e m P a r a m . n o i s e " , " v a l u e " : - 8 4 2 . 1 , " r e a d o n l y " : [ " o r g . a r l . y o d a . M o d e m P a r a m . n o i s e " ] , " m s g I D " : " c 4 6 8 b 2 8 c - 9 3 8 5 - 4 9 a 3 - 9 c 2 8 - a 8 6 5 e d 7 e 9 8 b c " , " p e r f " : " I N F O R M " , " r e c i p i e n t " : " W e b G W - c e a 1 9 a 9 d 3 7 f b e b 0 8 " , " s e n d e r " : " p h y " , " i n R e p l y T o " : " f 9 0 a 8 1 f 2 4 4 6 6 5 2 4 8 5 c a 7 3 1 b 0 7 a 5 6 1 e 9 3 " , " s e n t A t " : 1 6 1 5 4 2 0 6 8 6 4 3 0 } } , " r e l a y " : f a l s e }
])
************************************
******* MESSAGE DEBUG PRINT ********
(() . #[{ " a c t i o n " : " s e n d " , " m e s s a g e " : { " c l a z z " : " o r g . a r l . f j a g e . G e n e r i c M e s s a g e " , " d a t a " : { " m s g I D " : " e 2 1 2 4 c 9 c - 0 b 2 9 - 4 c 4 3 - 8 c 2 c - b 8 a d 2 3 8 c 4 1 8 a " , " i n R e p l y T o " : " 2 e 6 9 3 c b d 2 4 1 9 b 8 7 c b f a 9 c b 7 8 f 5 d 8 8 0 b f " , " p e r f " : " A G R E E " , " r e c i p i e n t " : " W e b G W - c e a 1 9 a 9 d 3 7 f b e b 0 8 " , " s e n d e r " : " w e b s h " , " a n s " : " a u t o " } } , " r e l a y " : f a l s e }
])
************************************
******* MESSAGE DEBUG PRINT ********
(() . #[{ " a c t i o n " : " s e n d " , " m e s s a g e " : { " c l a z z " : " o r g . a r l . f j a g e . G e n e r i c M e s s a g e " , " d a t a " : { " m s g I D " : " 1 e f f b 6 8 6 - a 0 5 a - 4 3 a d - a 5 a e - d 7 2 2 d 5 3 4 b b 1 9 " , " i n R e p l y T o " : " d 7 d e c 5 e b 6 a 2 3 d 6 8 3 d 6 8 2 7 3 6 2 c 8 4 d 0 2 8 f " , " p e r f " : " A G R E E " , " r e c i p i e n t " : " W e b G W - c e a 1 9 a 9 d 3 7 f b e b 0 8 " , " s e n d e r " : " w e b s h " , " a n s " : " t c p : / / 1 0 . 0 . 3 . 1 : 1 1 0 0 , t c p : / / 1 9 2 . 1 6 8 . 0 . 1 4 : 1 1 0 0 , t c p : / / 1 9 2 . 1 6 8 . 0 . 1 6 5 : 1 1 0 0 [ A P I ] \ n w s : / / 1 0 . 0 . 3 . 1 : 8 0 8 0 / w s , w s : / / 1 9 2 . 1 6 8 . 0 . 1 4 : 8 0 8 0 / w s , w s : / / 1 9 2 . 1 6 8 . 0 . 1 6 5 : 8 0 8 0 / w s [ A P I ] \ n t c p : / / / 1 0 . 0 . 3 . 1 : 1 1 0 0 / / 1 0 . 0 . 3 . 1 . 3 5 9 5 6 [ A P I ] \ n u n e t s h : c o n s o l e : / / - [ G r o o v y S c r i p t E n g i n e ] \ n w e b s h : w s : / / 1 2 7 . 0 . 1 . 1 : 8 0 8 0 / f j a g e / s h e l l / w s [ G r o o v y S c r i p t E n g i n e ] " } } , " r e l a y " : f a l s e }
])
************************************
******* MESSAGE DEBUG PRINT ********
(() . #[{ " a c t i o n " : " s e n d " , " m e s s a g e " : { " c l a z z " : " o r g . a r l . f j a g e . p a r a m . P a r a m e t e r R s p " , " d a t a " : { " i n d e x " : - 1 , " v a l u e s " : n u l l , " p a r a m " : " o r g . a r l . y o d a . M o d e m P a r a m . n o i s e " , " v a l u e " : - I n f i n i t y , " r e a d o n l y " : [ " o r g . a r l . y o d a . M o d e m P a r a m . n o i s e " ] , " m s g I D " : " f a b 5 e 8 4 8 - 4 6 7 6 - 4 1 4 9 - b 6 2 8 - 7 b b 5 a 4 8 2 a 0 f e " , " p e r f " : " I N F O R M " , " r e c i p i e n t " : " W e b G W - c e a 1 9 a 9 d 3 7 f b e b 0 8 " , " s e n d e r " : " p h y " , " i n R e p l y T o " : " a d a 8 d 2 7 1 2 3 6 e 8 d 5 6 0 f 1 7 d 2 9 7 9 e 5 0 2 0 7 4 " , " s e n t A t " : 1 6 1 5 4 2 0 6 8 9 4 3 1 } } , " r e l a y " : f a l s e }
])
************************************
terminate called after throwing an instance of 'boost::system::system_error'
what(): End of file
>>> Done (return code -6)
I am trying to send this JSON message but the connection was closed before even i do anything.
Is there specific JSON response needed by unetstack to keep the connection active ?

The JSON protocol used by UnetStack is from fjåge. The full specification of the protocol can be found here: https://fjage.readthedocs.io/en/latest/protocol.html
The protocol expects an acknowledgement to the {"alive": true} JSON message within a short timeout (5 seconds). If it receives no acknowledgement, it will close the connection, assuming that the connecting party is not responsive. The correct acknowledgement is a {"alive": true} sent back to confirm that the connection is indeed alive.
The above handshake is designed to cater for other transports such as RS232 where a disconnection can only be detected by communicating over the connection.

Related

Batch loop for password

I need help writing a script for batch.
I forgot the password for a file, it's a simple password 4 chars ( 1234, asdf, qwer) .
The command line is this:
C:\Users\DB> .\open.exe --file=db1.bin --password=asdf
Logging to C:\Users\DB\open.log
Error: failed to load: invalid password
I managed to generate a list of passwords (pass.txt) since the number is either 1st or last in string and only lower case but still there are couple thousands. Is there any way to automate this?
To iterate over a text file, use a for /f loop.
for /f %%A in (pass.txt) do open.exe --file=db1.bin --password=%%A
If you want it to track where you are in the file, add an echo.
for /f %%A in (pass.txt) do (
echo Now trying %%A
open.exe --file=db1.bin --password=%%A
)
#echo off
(
for %%a in (0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
for %%b in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
for %%c in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
for %%d in (0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
echo(%%a%%b%%c%%d
)
)
)
)
)>pass.txt
needs about half a minute to generate all possible 808496 passwords
{letter | number}{letter}{letter}{letter | number}
where only start OR end may be a number). If both start AND end could be a number, just skip the last two lines (876096 passwords)

Remove spaces between characters of output Batch file

I have a batch file that outputs the Wi-Fi adapter MAC address to a text file using the command wmic nic where "name like '%%802%%'" get name,macaddress and there are spaces between characters. I get the same thing for sfc /scannow in a batch file.
The output of the wmic command is:
Hostname: SOME-COMPUTER
A C A d d r e s s N a m e
3 4 : F 6 : B 3 : J 3 : 6 3 : 1 3 B r o a d c o m 8 0 2 . 1 1 n N e t w o r k A d a p t e r
The snippet of output of the sfc scan is:
n 3 0 % c o m p l e t e . V e r i f i c a t i o n 3 1 % c o m p l e t e . V e r i f i c a t i o n 3 1 % c o m p l e t e . V e r i f i c a t i o n 3 2 % c o m p l e t e . V e r i f i c a t i o n 3 2 % c o m p l e t e . V e r i f i c a t i o n 3 3 % c o m p l e t e . V e r i f i c a t i o n 3 3 % c o m p l e t e . V e r i f i c a t i o n 3 4 % c o m p l e t e . V e r i f i c a t i o n 3 4 % c o m p l e t e . V e r i f i c a t i o n 3 5 % c o m p l e t e . V e r i f i c a t i o n 3 5 % c o m p l e t e . V e r i f i c a t i o n 3 5 % c o m p l e t e . V e r i f i c a t i o n 3 6 % c o m p l e t e . V e r i f i c a t i o n 3 6 % c o m p l e t e . V e r i f i c a t i o n 3 7 % c o m p l e t e . V e r i f i c a t i o n 3 7 % c o m p l e t e . V e r i f i c a t i o n 3 8 % c o m p l e t e . V e r i f i c a t i o n 3 8 % c o m p l e t e . V e r i f i c a t i o n 3 9 % c o m p l e t e . V e r i f i c a t i o n 3 9 % c o m p l e t e . V e r i f i c a t i o n 4 0 % c o m p l e t e . V e r i f i c a t i o n 4 0 % c o m p l e t e . V e r i f i c a t i o n 4 1 % c o m p l e t e . V e r i f i c a t i o n 4 1 % c o m p l e t e . V e r i f i c a t i o n 4 2 % c o m p l e t e . V e r i f i c a t i o n 4 2 % c o m p l e t e . V e r i f i c a t i o n 4 2 % c o m p l e t e . V e r i f i c a t i o n 4 3 % c o m p l e t e . V e r i f i c a t i o n 4 3 % c o m p l e t e . V e r i f i c a t i o n 4 4 % c o m p l e t e . V e r i f i c a t i o n 4 4 % c o m p l e t e . V e r i f i c a t i o n 4 5 % c o m p l e t e . V e r i f i c a t i o n 4 5 % c o m p l e t e . V e r i f i c a t i o n 4 6 % c o m p l e t e . V e r i f i c a t i o n 4 6 % c o m p l e t e . V e r i f i c a t i o n 4 7 % c o m p l e t e . V e r i f i c a t i o n 4 7 % c o m p l e t e . V e r i f i c a t i o n 4 8 % c o m p l e t e . V e r i f i c a t i o n 4 8 % c o m p l e t e . V e r i f i c a t i o n 4 9 % c o m p l e t e . V e r i f i c a t i o n 4 9 % c o m p l e t e . V e r i f i c a t i o n 5 0 % c o m p l e t e . V e r i f i c a t i o n 5 0 % c o m p l e t e . V e r i f i c a t i o n 5 0 % c o m p l e t e . V e r i f i c a t i o n 5 1 % c o m p l e t e . V e r i f i c a t i o n 5 1 % c o m p l e t e . V e r i f i c a t i o n 5 2 % c o m p l e t e . V e r i f i c a t i o n 5 2 % c o m p l e t e . V e r i f i c a t i o n 5 3 % c o m p l e t e . V e r i f i c a t i o n 5 3 % c o m p l e t e . V e r i f i c a t i o n 5 4 % c o m p l e t e . V e r i f i c a t i o n 5 4 % c o m p l e t e . V e r i f i c a t i o n 5 5 % c o m p l e t e . V e r i f i c a t i o n 5 5 % c o m p l e t e . V e r i f i c a t i o n 5 6 % c o m p l e t e . V e r i f i c a t i o n 5 6 % c o m p l e t e . V e r i f i c a t i o n 5 7 % c o m p l e t e . V e r i f i c a t i o n 5 7 % c o m p l e t e . V e r i f i c a t i o n 5 7 % c o m p l e t e . V e r i f i c a t i o n 5 8 % c o m p l e t e . V e r i f i c a t i o n 5 8 % c o m p l e t e . V e r i f i c a t i o n 5 9 % c o m p l e t e . V e r i f i c a t i o n 5 9 % c o m p l e t e . V e r i f i c a t i o n 6 0 % c o m p l e t e . V e r i f i c a t i o n 6 0 % c o m p l e t e . V e r i f i c a t i o n 6 1 % c o m p l e t e . V e r i f i c a t i o n 6 1 % c o m p l e t e . V e r i f i c a t i o n 6 2 % c o m p l e t e . V e r i f i c a t i o n 6 2 % c o m p l e t e . V e r i f i c a t i o n 6 3 % c o m p l e t e . V e r i f i c a t i o n 6 3 % c o m p l e t e . V e r i f i c a t i o n 6 4 % c o m p l e t e . V e r i f i c a t i o n 6 4 % c o m p l e t e . V e r i f i c a t i o n 6 4 % c o m p l e t e . V e r i f i c a t i o n 6 5 % c o m p l e t e . V e r i f i c a t i o n 6 5 % c o m p l e t e . V e r i f i c a t i o n 6 6 % c o m p l e t e . V e r i f i c a t i o n 6 6 % c o m p l e t e . V e r i f i c a t i o n 6 7 % c o m p l e t e . V e r i f i c a t i o n 6 7 % c o m p l e t e . V e r i f i c a t i o n 6 8 % c o m p l e t e . V e r i f i c a t i o n 6 8 % c o m p l e t e . V e r i f i c a t i o n 6 9 % c o m p l e t e . V e r i f i c a t i o n 6 9 % c o m p l e t e . V e r i f i c a t i o n 7 0 % c o m p l e t e . V e r i f i c a t i o n 7 0 % c o m p l e t e . V e r i f i c a t i o n 7 1 % c o m p l e t e . V e r i f i c a t i o n 7 1 % c o m p l e t e . V e r i f i c a t i o n 7 1 % c o m p l e t e . V e r i f i c a t i o n 7 2 %
When I run these commands from cmd.exe, the output looks like this:
MACAddress Name
34:F2:B3:A1:83:33 Broadcom 802.11n Network Adapter
I would use PowerShell normally, but that is not what I need here. I would like the output to look like this in the output file.
The output doesn't seem to care if I use setlocal enabledelayedexpansion endlocal, as the output is the same.
Thank you for your help!
EDIT
I created a blank Unicode file ( I have Windows 10 ), and copied it to a new file I used for the output file. Now, the spaces are gone, but for whatever reason, the variable created for the hostname outputs what appears to be Chinese characters:
潈瑳慮敭›䕄䭓佔ⵐ䩒䵔剄⁓਍MACAddress Name
34:F2:B3:A1:83:33 Broadcom 802.11n Network Adapter
The hostname command was used as follows:
for /f "delims= tokens=*" %%i in ('hostname') do (
set "nameHost=%%i"
)
Then, I changed tokens=* to tokens=2 and all of the characters were Chinese. Anyway, a work-around was to add the hostname to the filename instead, which resolves this issue. However, it would be ideal to learn how to have both ANSI and Unicode strings in the same file, without the spaces.
I saw a C++ article about this and the answer was to change the code; therefore, if that it true, I don't have the code for sfc or wmic, so am I SOL there, or is there a way to have both ANSI and Unicode strings in the same file without the spaces between each character?
wmic nic where "name like '%%802%%'" get name,macaddress|more
should provide you with an ANSI version - the problem there is Unicode-output from WMIC.

How would I convert an argument into a string in bash

When I run the script I enter a single argument. I want to store the argument into a variable and access it as a string. So if I enter $ ./script foo I should be able to access f, o, and o. So echo $pass[0] should display f
but what I am finding is that $pass is storing the argument as one piece
so echo $pass[0] displays foo
How do I access the different positions in the string?
#!/bin/bash
all=( 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z )
pass=$1
max=${#pass}
for (( i=0; i<max; i++ ))
do
for (( n=0; n<10; n++ ))
do
if [ "${pass[$i]}" == ${all[$n]} ]
then
echo true
else
echo false i:$i n:$n pass:${pass[$i]} all:${all[$n]}
fi
done
done
To spell out Etan's comment in the context of this question:
set -- "my password"
chars=()
for ((i=0; i<${#1}; i++)); do chars+=("${1:i:1}"); done
declare -p chars
outputs
declare -a chars='([0]="m" [1]="y" [2]=" " [3]="p" [4]="a" [5]="s" [6]="s" [7]="w" [8]="o" [9]="r" [10]="d")'

SaveToFile and then open it formating text weird

Okay so I am writing a program that imports a database to an text file Via (SaveToFile command) .But when I open the file normally it gives me.
TG! ¶’ò?²Ï# ª _þX g Ò­cöëÏ°ã ª ? Á<Ž¶ëmÐö ª _þX
| ¾"µÈó\Î­å ª Dw= ÿÿ† ÿÿ" I Á<Ž¶ëmÐö ª _þX 2 . " C l i e n t s " C l i e n t s + ð I D I D
ÿ Z ÿÿÿÿC ð S u r e n a m e S u r e n a m e ‚ ÿ ÿ j ÿÿC ð P a s s w o r d P a s s w o r d
ÿ z ÿÿ3 ð N a m e N a m e ‚ ÿ ÿ j ÿÿK ð
M o n e y P a i d
M o n e y P a i d ÿ z ÿÿK ð
M o n e y O w e d
M o n e y O w e d ÿ z ÿÿ[ ð O n c e O f f C l i e n t O n c e O f f C l i e n t ÿ ÿ Z ÿÿC ð P h o n e I D P h o n e I D
ÿ z ÿÿÿ a w e a w e Ó–I
Here is my code:
procedure TfrmRawDATA.btnStoreFeedClick(Sender: TObject);
var
StoreFeed : string;
StoreFeedFile: TextFile;
data : string;
begin
begin
if (FileExists('C:\Users\ASROCK\Desktop\IT-PAT 2014\PAT Fase 3\StoreFeedFile.txt')) then
begin
DeleteFile('C:\Users\ASROCK\Desktop\IT-PAT 2014\PAT Fase 3\StoreFeedFile.txt');
ShowMessage('Save file deleted!');
end
else
AssignFile(StoreFeedFile,'Test.txt');
FileSetAttr('C:\Users\ASROCK\Desktop\IT-PAT 2014\PAT Fase 3\StoreFeedFile.txt', faReadOnly);
dmMJCPlus.tblClients.SaveToFile('C:\Users\ASROCK\Desktop\IT-PAT 2014\PAT Fase 3\StoreFeedFile.txt');
end;
end;
I just wanna know how to set like the file type or something so it doesn't give me that text.
The default saving format for ADO table/query and ClientDataSet is binary. You have the option of using XML though. You need to specify it in the call to SaveToFile:
ClientDataSet.SaveToFile('...', dfXML);
or
ADOTable.SaveToFile('...', pfXML);
Having a file extension of '.xml' should achieve the same, looking at the source, though it would seem it didn't turn out to be the case for you (as you seem to have tried it in the comments).
pfXML/dfXML are defined in 'adodb.pas' and 'dbclient.pas' respectively.

C reading csv file

I'm running into a problem I haven't encountered before and am baffled... for some reason when I try to read a CSV file char by char but it seems like spaces are somehow getting placed there... and what's weirder is the fact that no space chars exist anywhere. I will give an example...
char *readgd(const char *fname)
{
char *gddata, *tmp;
FILE *fp;
int buff = 1024, c = 0, ch;
if(!(fp = fopen(fname, "r")))
{
printf("\nError! Could not open %s!", fname);
return 0x00;
}
if(!(gddata = malloc(buff)))
{
fclose(fp);
printf("\nError! Memory allocation failed!");
return 0x00;
}
while(ch != EOF)
{
c++;
ch = fgetc(fp);
if(buff <= c)
{
buff += buff;
if(!(tmp = realloc(gddata, buff)))
{
free(gddata);
fclose(fp);
printf("\nError! Memory allocation failed!");
}
gddata = tmp;
}
gddata[c - 1] = ch;
if(gddata[c - 1] != ' ') printf("%c", gddata[c - 1]); //no spaces?
}
if(!(tmp = realloc(gddata, c + 1)))
{
free(gddata);
fclose(fp);
printf("\nError! Memory allocation failed!");
}
gddata = tmp;
gddata[c] = 0x00;
fclose(fp);
return gddata;
}
with the following CSV snippet:
:Tagname,Area,SecurityGroup,Container,ContainedName,ShortDesc,ExecutionRelativeOrder,ExecutionRelatedObject,UDAs,Extensions,CmdData,Address_ACbHAlmCfg,Address_ACbHWarnCfg,Address_ACbLAlmCfg,Address_ACbLWarnCfg,Address_ACbTfCfg,Address_ACrHAlmDb,Address_ACrHAlmSp,Address_ACrHAlmTmrSp,Address_ACrHWarnDb,Address_ACrHWarnSp,Address_ACrHWarnTmrSp,Address_ACrLAlmDb,Address_ACrLAlmSp,Address_ACrLAlmTmrSp,Address_ACrLWarnDb,Address_ACrLWarnSp,Address_ACrLWarnTmrSp,Address_ACrTfTmrSp,Address_bHalm,Address_bHWarn,Address_bLAlm,Address_bLwarn,Address_bMode,Address_bTfAlm,Address_rCCmd,Address_rVal,
outputs this onto the console:
 
■: T a g n a m e , A r e a , S e c u r i t y G r o u p , C o n t a i n e r , C
o n t a i n e d N a m e , S h o r t D e s c , E x e c u t i o n R e l a t i v e
O r d e r , E x e c u t i o n R e l a t e d O b j e c t , U D A s , E x t e n s
i o n s , C m d D a t a , A d d r e s s _ A C b H A l m C f g , A d d r e s s _
A C b H W a r n C f g , A d d r e s s _ A C b L A l m C f g , A d d r e s s _ A
C b L W a r n C f g , A d d r e s s _ A C b T f C f g , A d d r e s s _ A C r H
A l m D b , A d d r e s s _ A C r H A l m S p , A d d r e s s _ A C r H A l m T
m r S p , A d d r e s s _ A C r H W a r n D b , A d d r e s s _ A C r H W a r n
S p , A d d r e s s _ A C r H W a r n T m r S p , A d d r e s s _ A C r L A l m
D b , A d d r e s s _ A C r L A l m S p , A d d r e s s _ A C r L A l m T m r S
p , A d d r e s s _ A C r L W a r n D b , A d d r e s s _ A C r L W a r n S p ,
A d d r e s s _ A C r L W a r n T m r S p , A d d r e s s _ A C r T f T m r S p
, A d d r e s s _ b H a l m , A d d r e s s _ b H W a r n , A d d r e s s _ b L
A l m , A d d r e s s _ b L w a r n , A d d r e s s _ b M o d e , A d d r e s s
_ b T f A l m , A d d r e s s _ r C C m d , A d d r e s s _ r V a l ,
I am very confused as to where these spaces are coming from. Any help would be greatly appreciated.
Are you sure the CSV is not encoded with UTF-16 (using two bytes per character)?
This is the most likely reason you'd see spaces between otherwise valid ASCII characters, so try verifying the encoding first.

Resources