Jump to content

Read struct from .bin file!!!??


xbennY0
 Share

Go to solution Solved by Melba23,

Recommended Posts

xbennY0,

If all you requires is all the data in one file, then what I suggested in post #16 above should be what you need. :)

M23

is it possible save a struct in autoit like c++ containing all data in one single file? or create multiple structs like: 

Local Const $Struct1 = "struct;" & _
                                "char var1[128];" & _
                                "byte var2;" & _
                                "uint var3;" & _
                                "char var4[128];" & _
                        "endstruct"

 Local $tSTRUCT1[50] = DllStructCreate($Struct1)
Edited by xbennY0
Link to comment
Share on other sites

  • Moderators

xbennY0,

You can add the data from each file to the master file as you loop through them - there is no need to use a struct. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

bennY0,

You can add the data from each file to the master file as you loop through them - there is no need to use a struct. :)

M23

 

Interesting! how can i do this using the _FileListToArrayRec?

Edited by xbennY0
Link to comment
Share on other sites

  • Moderators
  • Solution

xbennY0,

Somehow I knew you would ask that: :D

Here is a short example which just looks for 2 files in the AutoIt Include folder and adds them to a single file:

#include <File.au3>
#include <Array.au3>

; Name of file to create
$sFile = @ScriptDir & "\Master File.txt"

; Root path of the folders to seach for files - this gets the current Include folder
$sPath = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", Default, -1)) & "Include\"

; You would need to adjust the path so that it returns all the files you want to add to the master file
; Here we are just looking for Process.au3 and ProcessConstants.au3
$aList = _FileListToArrayRec($sPath, "Process*.au3", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH)

; These are the files returned - you should have 2
_ArrayDisplay($aList, "", Default, 8)

; We now create the master file
$hFile = FileOpen($sFile, 2)
; And loop through the fiel list adding the content with some delimiters so we know where one ends and the next one starts
For $i = 1 To $aList[0]
    $VContent = FileRead($aList[$i])
    FileWrite($hFile, $aList[$i] & @CRLF & "----------" & @CRLF & $vContent & @CRLF & "###############################################" & @CRLF & @CRLF)
Next
; We close the file
FileClose($hFile)

; And now open NotePad to display it
ShellExecute($sFile)
All clear? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

xbennY0,

Somehow I knew you would ask that: :D

Here is a short example which just looks for 2 files in the AutoIt Include folder and adds them to a single file:

#include <File.au3>
#include <Array.au3>

; Name of file to create
$sFile = @ScriptDir & "\Master File.txt"

; Root path of the folders to seach for files - this gets the current Include folder
$sPath = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", Default, -1)) & "Include\"

; You would need to adjust the path so that it returns all the files you want to add to the master file
; Here we are just looking for Process.au3 and ProcessConstants.au3
$aList = _FileListToArrayRec($sPath, "Process*.au3", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH)

; These are the files returned - you should have 2
_ArrayDisplay($aList, "", Default, 8)

; We now create the master file
$hFile = FileOpen($sFile, 2)
; And loop through the fiel list adding the content with some delimiters so we know where one ends and the next one starts
For $i = 1 To $aList[0]
    $VContent = FileRead($aList[$i])
    FileWrite($hFile, $aList[$i] & @CRLF & "----------" & @CRLF & $vContent & @CRLF & "###############################################" & @CRLF & @CRLF)
Next
; We close the file
FileClose($hFile)

; And now open NotePad to display it
ShellExecute($sFile)
All clear? :)

M23

 

Got it! You are the best!

but i think this is not the best choice...is it possible put all this files in my .exe using the Resource UDF making it readable after?

I'm sorry for so many questions :(

Edited by xbennY0
Link to comment
Share on other sites

  • Moderators

xbennY0,

 

is it possible put all this files in my .exe using the Resource UDF making it readable after?

And where did this part of the overall requirement come from? I hate people continually changing the goalposts as the thread progresses, so either I get an explanation of what exactly you are trying to do or that is as far as my help goes. :mad:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

xbennY0,

 

And where did this part of the overall requirement come from? I hate people continually changing the goalposts as the thread progresses, so either I get an explanation of what exactly you are trying to do or that is as far as my help goes. :mad:

M23

Sorry...

Link to comment
Share on other sites

  • Moderators

xbennY0,

Apology accepted. :)

So are you going to tell us? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...