473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Read big characters

Well, I will like to know how to read and store a plain text, like this, "My name is Edwin Alxis Alvear Candelo and I am 22 yards old", and I also want to split this text in blocks of 24 character of the phrase. for example the text: “The quick brown fox jumped", I will like to read it and then split it like this:

TEXT Hexadecimal format

“The quic” 5468652071756663

“k brown ” 6B2062726F776E20

“fox jump” 666F78206A756D70

Thank you very much.
Aug 25 '06 #1
5 1605
The user should enter the length of the phrase.
Aug 25 '06 #2
you can use strings just like arrays. So just copy out the parts you need into new arrays.
Aug 25 '06 #3
D_C
293 100+
If unsigned long long is 64-bits (8 bytes), you should use that. I think this is what you are looking for. I haven't tested it yet, but it should give you a step in the right direction.

Expand|Select|Wrap|Line Numbers
  1. //string data = "The quick brown fox jump";
  2. unsigned int tracker;
  3. int length = ((sizeof)data)/8;
  4. if((data % 8) != 0)
  5.   length++;
  6. unsigned long long groupedChars[length];
  7.  
  8. for(int i = 0; i < length; i++)
  9. {
  10.   tracker = 1<<7; // ((1 << 7) >> 8) == 0
  11.   while(tracker != 0)
  12.   {
  13.     groupedChars *= 0x0100; // shift one byte left
  14.  
  15.     if(data != "")
  16.     {
  17.       groupedChars[i] += data.substring(0,1); // may need to cast as ull
  18.       data = data.erase(0,1);
  19.     }
  20.     tracker >> 1;
  21.   }
  22. }
Aug 25 '06 #4
Banfa
9,065 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1.   tracker = 1<<7; // ((1 << 7) >> 8) == 0
  2.   while(tracker != 0)
  3.   {
  4.     ...
  5.     tracker >> 1;
  6.   }
  7.  
Is a slightly odd way of doing
Expand|Select|Wrap|Line Numbers
  1.   for(tracker = 0; tracker<8; tracker++)
  2.   {
  3.     ...
  4.   }
  5.  
since you are not using tracker in any calculations

also you have missed a [i] out of the first line of the loop.
Aug 26 '06 #5
Well I need to save each block in a 64 bits variable (__int64), for example:

“The quick brown fox jumped", I will like to split it like this:

TEXT Hexadecimal format

“The quic” 5468652071756663

“k brown ” 6B2062726F776E20

“fox jump” 666F78206A756D70


So I must save in one variable Text1 = 5468652071756663, Text2 = 6B2062726F776E20 and Text3 = 666F78206A756D70 and so on, depending on the length of a text.

Thank you very much.
Aug 28 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
2
by: Profetas | last post by:
I have the following code that detects a <c> and </c> #include <stdio.h> main(int argc, char *argv) { FILE* fp; char data;
7
by: Naren | last post by:
Hello All, Can any one help me in this file read problem. #include <stdio.h> int main() {
9
by: Carramba | last post by:
#include <stdio.h> int main( void ){ char cQuit = 'a'; char cKommando , artistNamn , skivansNamn , cChar; int cK ; FILE *pekaFile; printf( "l - for read file\n"); printf( "s - for writte...
35
by: RyanS09 | last post by:
Hello- I am trying to write a snippet which will open a text file with an integer on each line. I would like to read the last integer in the file. I am currently using: file = fopen("f.txt",...
2
by: Rajen | last post by:
Suppose the field length is 25 characters. After entering the 25th character, it should be available to process. Program should not wait for the user to press enter/return key. Thank you.
7
by: asvini | last post by:
Hi I want to read a file which has data and null characters in between... But my program terminates on encountering NULL characters...is there any other way to read the whole file with the NULL...
6
by: Deep | last post by:
Suppose there is a character of one byte then max characters possible under this are 256. If characters are of two bytes then max chars should be 65536. Now if character can be of one byte or two...
1
by: aemado | last post by:
I am trying to read in several lines, each should have exactly 5 pieces of data. I am using try/catch/throw to determine if the data is in the correct format, and trying to use iss to separate the...
3
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I'm creating an application that will read emails from GMail, using the System.Net.Sockets.TcpClient and POP protocol. However, I am having a problem with my SslStream. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.