Read INI (getprivateprofilestring)...max of 255 characters!! -
Okay, here is the code im using to read files:
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Function ReadINI(FileName As String, Section As String, Key As String)
Ret = Space$(255)
retlen = GetPrivateProfileString(Section, Key, "", Ret, Len(Ret), FileName)
Ret = Left$(Ret, retlen)
ReadINI = Ret
FileName)
End Function
Anyway, when I use this to read a file, I get a return of 255 characters. Im guessing this is because of:
Ret = Space$(255)
I played around with the number, changing it from 255 to higher numbers until it eventually maxed out.
How can I read large files (maybe around 15-30 pages)?
Am I using the wrong code to do this?
Read INI (getprivateprofilestring)...max of 255 characters!! -
Okay, here is the code im using to read files:
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVa
Loading ini file values -
I'm using the GetPrivateProfileString API function to read all the values stored in the app's ini file at program start. The way I do it is, I make repeated calls to GetPrivateProfileString and at each call one variable is read.
Everything works fine but then I thought, does it make
not reading entire ini file -
I am using getprivateprofilestring to read from an ini file. It seems that I can only read so far down the ini file and it stops. I am searching for a key in a particular section name that I know exists. If I put the section in the top half of the file, I can read it. If I put it i
Read From TextFile -
Hi everybody,
do you guys know how to use VB6 to read certain amount of characters from a textfile with a lot of characters in single line ? for example: a text file with 10,000 characters in single line and I want to get the first 1,000 characters only. if this way can be done in V
GetPrivateProfileString, not from file, from string -
I'm using the GetPrivateProfileString function to read INI's, it does what I need it to do, but I need to make it so instead of running the function on a file, I need it to run the function on a string. Right now, I have my app writing the string to a file (String is from a MySQL), the
Reading an unset amount of characters -
What I am trying to do is take information from a text file (sorted)
The read the first few characters, which are not a set length (IP addresses)
Then take those characters and save them to a seperate file
Then to delete all lines in the original text file, where those characters ar
ini file virgin question -
Quick questions:
From what I've read, ini files can only be read or written thru' the api via GetPrivateProfileString and WritePrivateProfileString. Is this statement correct?
I thought that there might be a native VB method. Is there and I just haven't found it?
Thank you f
Reading X number of characters from a text file... -
I have a text file and I need to read X number of characters from it starting at Y.
How can I read those characters even if they are not on the same line?
For example, if my file holds:
12345
678
9ABCDEF
GHI
and I want characters 4-12, I want to see 456789ABC.
Any sug
GetPrivateProfileString -
what's wrong w/ this........
GetPrivateProfileString (App.EXEName, strKey, "", strValue, 1024, strINIPath) ?
it just returns the Default(""), even when there is definitely a value that should be returned.
thnx!
Debugging and GetPrivateProfileString -
Hi everyone, this is my first time here.. and I hope somebody have encountered this problem before...
the thing is that, I have an app that gets values from ini and is using API
GetPrivateProfileString
it is fine when I run the application as an exe, but then if I debug it.. the p
connection strings and ini file -
anyone got an example of how to read server and database name for a sql server from an ini file in .Net.
In vb.6 i would use an api call to GetPrivateProfileString...
then simply from a function use the following code:
Quote:
retval = GetPrivateProfileStri
Read/write INI files under NT -
Hello!
I have one (quite) simple question:
Can I use GetPrivateProfileString and WritePrivateProfileString under WinNT 4?
INI Help -
I am trying to read multiple items from an INI file located in the same directory as my application. I can read different areas of the INI file but I cannot display them or use them in the same msgbox. Please see code below:
Private Declare Function GetPrivateProfileString _
Li
GetPrivateProfileString question [resolved] -
Can I do this?
GetPrivateProfileString("General", "version", "", strBuffer, 30, "http://www.somewebsite.co.uk/config.txt")
I want to have my VB6 app check for updates online - but this doesn't seem to work.
Simon
Microsoft Word - reading characters -
Hi there
I need to read characters in word document and insert an enter (new line) every 60 characters.
Can anybody help with what command let me reed the charcters and chceck if its enter or not ?
If there is no enter afer 60 characters then I can put one.
Cheers
string limit 50 -
i found this code on here today for use of ini files and it works great
but the Dim strResult As String * 50 has me confused. i need more than 50 characters per line so i changed it to 500 and it seems to still work fine.
but i am learning vb by example the best that i can , an
read/write ini files -
I want to use an ini file in my application.
In VB6 I would use the API calls
GetPrivateProfileString and WritePrivateProfileString. Does anyone know how to read/write ini files in .NET.
I looked on allapi but there is no .NET equivalent.
Does this mean there isn't one.
String Handling **resolved** -
hey everyone, i have a question. how many characters can a string handle? i am using an input statement and it is only reading in the first 354 characters. and i need it read in more like a 600 to 800 characters.
any help would be great thanks
How can I parse this log file -
I'm having trouble parsing a certain log file. More specifically, none of the .Net reader classes seem to be able to effectively read in the data. Here is a bit of the file:
w m ª €œ ‚è‡ÐîÅI n f o I N T S P T
I need to be able to read in all of this data
Need help reading a file -
I need a way to read the contents of a binary file up to a certain string of characters & then read x number of characters after that. Could someone kindly show me how? Thanks...
reading wierd characters from a file -
Im trying to open a file that can have some really, really wierd characters. Any file open sub I try interprets those box characters as line breaks, or some other wierd thing like that. Say I had the attached zip. How could I have a sub that read the exact text?
Make sure you read t
ascii char -
Hello,
I made a program for read ascii characters from modem with win 98 2 ed. and VB6, It were working fine, but now I change to winxp and I can't see the ascii characters and I need these characters for controll the program.
I mean I started to read the string with char(13) and
retrieve from ini with getprivateprofilestring -
I am having trouble retrieving from an ini. I only get a blank string. Any help would be appreciated!
Here's my code:
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal
Corrupt XML or Text Files on File Server -
Hello Everyone,
Thanks for your time to read this. It's been quite frustrating. I'm working with a VB 6.0 system where a problem regarding corrupt files is plaguing the system.
Essentially, we have an web application (written using ASP intrinsics in Vb 6) and compiled into a
*RESOLVED * String Comparison Problem -
I have stored the names of two printers in an INI using WritePrivateProfileString. I read them back into two strings using GetPrivateProfileString. I then want to set the printer to the name of one of those strings:
Dim prn As Printer
Dim str As String
For Each prn In Printers
Read getprivateprofilestring C:\ and H:\ same time -
Hi
I´m using the API function «getprivateprofilestring» to read file notes.ini in drive c:\notes, then i use textbox to put the information i need into.
Sometimes notes.ini is intalled in drive c:\ and h:\, when i want to put the informaion into to different textbox it only
Replacing text in a file based on position -
What I am trying to accomplish is this in VB 2005:
Here is a sample of input data from a text file-
000000001111111122222233333333
000000001111111122222244444444
000000001111111122222255555555
What I would like to do is read 8 characters starting at position 23 and overwrite
GetPrivateProfileString problem in Win 98 & ME -
Hi
I have a large Ini file that contain many texts.
I use the API function: "GetPrivateProfileString" to get the text i need.
All works ok in 2000 & XP but in 98 & Me i get empty some empty strings.
I created a small project that get 3 texts from 3 locations: to
INI File Poser... -
Here's the story...
I'm using a function which implements GetPrivateProfileString to read values from an INI file. Now, this function requires a value for strApplicationname, which is basically the section of the INI File to read the value from. This is marked in the INI File by &qu
getprivateprofilestring -
Hi
I´m using the API function «getprivateprofilestring» to read file notes.ini in drive c:\notes, then i use textbox to put the information i need into.
Sometimes notes.ini is intalled in drive c:\..and h:\, when i want to put the informaion into to different textbox it only
INI file -
Can an INI file have a maximum length ?
I made 2 ini files. one is only 1 page long, the other is 50 pages long. When I try to read data with the GETPRIVATEPROFILESTRING-api, it returns the correct value from the 1 page long file, but from the 50 pages long file, he returns the defaul
Problems with GetPrivateProfileString -
I have found here tons of examples to use this API function. However, I am still having trouble using it.
It works fine when placing the returned data in a TextBox but I need to place it in a String variable and I get funky characters after the useful data I am looking for...
Her
Accented characters -
Hi
I'm using StreamReader to read a text file that contains 81 characters wide lines. When I read each line and display the width I get 81 for all lines except for one where I get 80. When I view the line in notepad I notice that the character
Quote:
É
Converting ascii to unicode in C# -
Ok, so i'm reading this file that has unicode text in it, but i dunno how to convert the read text into a unicode string.
I have a string that has "\0h\0e\0l\0l\0o" i want it to be a string that says "hello". I know i can do a simple remove "\0" and it
GetPrivateProfileString in Vista -
Hi there.
Our VB6 application runs well on XP.
Now one of our client has upgraded to Vista.
He said that he has managed to install and run our application on Vista. But seems that program can't pick up the old settings by GetPrivateProfileString function (the settings are stored i
format() -
I am using the format function. I need to have a defined amount of characters. For instance it may read in the number 15 however the field is 7 characters long so it needs to write to a file with leading 0's. Also how do you read in decimal numbers (e.g. 3.6) and make it write to a
need to read from Dos Window -
need to read from Dos Window:
need some code to read form dos windows that already open in my station (XP)
i want to read chars by position or read the all characters and manipolated in vb code.
I used VB6
Please help.
BR Yuval
GetPrivateProfileString - Removing '0' character from string -
I'M using the GetPrivateProfileString API and I just realised it was causing an error to mycode. I used the CIniFile class provided on vbworld.
Look carefully at the line in red, it fills the var all with 0. I need to remove them after, how do I achieve this ?
Code:
Public
replacing characters in strings -
Hi all,
I have a bit of a problem. I am trying to replace the first two characters in a string. I am getting some characters that arent needed and I want to remove just the first two characters. Is there any easy way to do this???
Those *other* characters... -
Ok, from 1 to 255 we can have some pretty strange characters, but I've also come across some weirder ones that aren't listed among those 255 ascii characters. Using visual basic how do I access those characters?